亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? form1.cs

?? Professional C# 2nd Edition
?? CS
字號:
using System;
using System.Drawing;
using System.Drawing.Printing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;

namespace Wrox.ProCSharp.GDIPlus
{
	class TextLineInformation
	{
		public string Text;
		public uint Width;
	}

	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{

	#region constant fields
		private const string standardTitle = "CapsEditor";
		// default text in titlebar
		private const uint margin = 10;
		// horizontal and vertical margin in client area
	#endregion

		private int printingPageNo = 0;

      #region Member fields
		private ArrayList documentLines = new ArrayList();   // the 'document'
		private uint lineHeight;        // height in pixels of one line
		private Size documentSize;      // how big a client area is needed to 
		// display document
		private uint nLines;            // number of lines in document
		private Font mainFont;          // font used to display all lines
		private Font emptyDocumentFont; // font used to display empty message
		private Brush mainBrush = Brushes.Blue; 
		// brush used to display document text
		private Brush emptyDocumentBrush = Brushes.Red;
		// brush used to display empty document message
		private Point mouseDoubleClickPosition;   
		// location mouse is pointing to when double-clicked
		private OpenFileDialog fileOpenDialog = new OpenFileDialog(); 
		// standard open file dialog
		private bool documentHasData = false;
		private System.Windows.Forms.MainMenu mainMenu1;
		private System.Windows.Forms.MenuItem menuFile;
		private System.Windows.Forms.MenuItem menuFileOpen;
		private System.Windows.Forms.MenuItem menuFileExit;
		private System.Windows.Forms.MenuItem menuFilePrint;
		private System.Windows.Forms.MenuItem menuFilePrintPreview;
		private System.Windows.Forms.MenuItem menuItem4;
		private System.Windows.Forms.MenuItem menuItem5; 
		// set to true if document has some data in it
      #endregion

		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Form1()
		{
			InitializeComponent();

			CreateFonts();
			fileOpenDialog.FileOk += new 
				System.ComponentModel.CancelEventHandler(
				this.OpenFileDialog_FileOk);
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.menuFile = new System.Windows.Forms.MenuItem();
			this.menuFileOpen = new System.Windows.Forms.MenuItem();
			this.menuItem5 = new System.Windows.Forms.MenuItem();
			this.menuFilePrint = new System.Windows.Forms.MenuItem();
			this.menuFilePrintPreview = new System.Windows.Forms.MenuItem();
			this.menuItem4 = new System.Windows.Forms.MenuItem();
			this.menuFileExit = new System.Windows.Forms.MenuItem();
			// 
			// mainMenu1
			// 
			this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					  this.menuFile});
			// 
			// menuFile
			// 
			this.menuFile.Index = 0;
			this.menuFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																					 this.menuFileOpen,
																					 this.menuItem5,
																					 this.menuFilePrint,
																					 this.menuFilePrintPreview,
																					 this.menuItem4,
																					 this.menuFileExit});
			this.menuFile.Text = "&File";
			// 
			// menuFileOpen
			// 
			this.menuFileOpen.Index = 0;
			this.menuFileOpen.Text = "&Open";
			this.menuFileOpen.Click += new System.EventHandler(this.menuFileOpen_Click);
			// 
			// menuItem5
			// 
			this.menuItem5.Index = 1;
			this.menuItem5.Text = "-";
			// 
			// menuFilePrint
			// 
			this.menuFilePrint.Enabled = false;
			this.menuFilePrint.Index = 2;
			this.menuFilePrint.Text = "&Print";
			this.menuFilePrint.Click += new System.EventHandler(this.menuFilePrint_Click);
			// 
			// menuFilePrintPreview
			// 
			this.menuFilePrintPreview.Enabled = false;
			this.menuFilePrintPreview.Index = 3;
			this.menuFilePrintPreview.Text = "Print Pre&view";
			this.menuFilePrintPreview.Click += new System.EventHandler(this.menuFilePrintPreview_Click);
			// 
			// menuItem4
			// 
			this.menuItem4.Index = 4;
			this.menuItem4.Text = "-";
			// 
			// menuFileExit
			// 
			this.menuFileExit.Index = 5;
			this.menuFileExit.Text = "E&xit";
			this.menuFileExit.Click += new System.EventHandler(this.menuFileExit_Click);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.BackColor = System.Drawing.Color.White;
			this.ClientSize = new System.Drawing.Size(492, 448);
			this.Menu = this.mainMenu1;
			this.Name = "Form1";
			this.Text = "CapsEditor";
			this.Load += new System.EventHandler(this.Form1_Load);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
		
		}

		protected void OpenFileDialog_FileOk(object Sender, CancelEventArgs e)
		{
			this.LoadFile(fileOpenDialog.FileName);
		}


		private void menuFileOpen_Click(object sender, System.EventArgs e)
		{
			fileOpenDialog.ShowDialog();		
		}

		private void menuFileExit_Click(object sender, System.EventArgs e)
		{
			this.Close();	
		}

		private void CreateFonts()
		{
			mainFont = new Font("Arial", 10);
			lineHeight = (uint)mainFont.Height;
			emptyDocumentFont = new Font("Verdana", 13, FontStyle.Bold);
		}

		private void LoadFile(string FileName)
		{
			StreamReader sr = new StreamReader(FileName);
			string nextLine;
			documentLines.Clear();
			nLines = 0;
			TextLineInformation nextLineInfo;
			while ( (nextLine = sr.ReadLine()) != null)
			{
				nextLineInfo = new TextLineInformation();
				nextLineInfo.Text = nextLine;
				documentLines.Add(nextLineInfo);
				++nLines;
			}
			sr.Close();
			if (nLines > 0)
			{
				documentHasData = true;
				menuFilePrint.Enabled = true;
				menuFilePrintPreview.Enabled = true;
			}
			else
			{
				documentHasData = false;
				menuFilePrint.Enabled = false;
				menuFilePrintPreview.Enabled = false;
			}

			CalculateLineWidths();
			CalculateDocumentSize();

			this.Text = standardTitle + " - " + FileName;
			this.Invalidate();
		}

		private void CalculateLineWidths()
		{
			Graphics dc = this.CreateGraphics();
			foreach (TextLineInformation nextLine in documentLines)
			{
				nextLine.Width = (uint)dc.MeasureString(nextLine.Text, 
					mainFont).Width;
			}
		}
		private void CalculateDocumentSize()
		{
			if (!documentHasData)
			{
				documentSize = new Size(100, 200);
			}
			else
			{
				documentSize.Height = (int)(nLines*lineHeight) + 2*(int)margin;
				uint maxLineLength = 0;
				foreach (TextLineInformation nextWord in documentLines)
				{
					uint tempLineLength = nextWord.Width + 2*margin;
					if (tempLineLength > maxLineLength)
						maxLineLength = tempLineLength;
				}
				documentSize.Width = (int)maxLineLength;
			}
			this.AutoScrollMinSize = documentSize;
		}

		protected override void OnPaint(PaintEventArgs e)
		{
			Graphics dc = e.Graphics;
			int scrollPositionX = this.AutoScrollPosition.X;
			int scrollPositionY = this.AutoScrollPosition.Y;
			dc.TranslateTransform(scrollPositionX, scrollPositionY);

			if (!documentHasData)
			{
				dc.DrawString("<Empty document>", emptyDocumentFont, 
					emptyDocumentBrush, new Point(20,20));
				base.OnPaint(e);
				return;
			}
			// work out which lines are in clipping rectangle
			int minLineInClipRegion = 
				WorldYCoordinateToLineIndex(e.ClipRectangle.Top - scrollPositionY);
			if (minLineInClipRegion == -1)
				minLineInClipRegion = 0;
			int maxLineInClipRegion = 
				WorldYCoordinateToLineIndex(e.ClipRectangle.Bottom - 
				scrollPositionY);
			if (maxLineInClipRegion >= this.documentLines.Count ||
 

				maxLineInClipRegion == -1)
				maxLineInClipRegion = this.documentLines.Count-1;

			TextLineInformation nextLine;
			for (int i=minLineInClipRegion; i<=maxLineInClipRegion ; i++)
			{
				nextLine = (TextLineInformation)documentLines[i];
				dc.DrawString(nextLine.Text, mainFont, mainBrush, 
					this.LineIndexToWorldCoordinates(i));
			}
			base.OnPaint(e);
		}

		private Point LineIndexToWorldCoordinates(int index)
		{
			Point TopLeftCorner = new Point(
				(int)margin, (int)(lineHeight*index + margin));
			return TopLeftCorner;
		}

		private int WorldYCoordinateToLineIndex(int y)
		{
			if (y < margin)
				return -1;
			return (int)((y-margin)/lineHeight);
		}

		private int WorldCoordinatesToLineIndex(Point position)
		{
			if (!documentHasData)
				return -1;
			if (position.Y < margin || position.X < margin)
				return -1;
			int index = (int)(position.Y-margin)/(int)this.lineHeight;
			// check position isn't below document
			if (index >= documentLines.Count)
				return -1;
			// now check that horizontal position is within this line
			TextLineInformation theLine = 
				(TextLineInformation)documentLines[index];
			if (position.X > margin + theLine.Width)
				return -1;

			// all is OK. We can return answer
			return index;
		}

		private Point LineIndexToPageCoordinates(int index)
		{
			return LineIndexToWorldCoordinates(index) + 
				new Size(AutoScrollPosition);
		}

		private int PageCoordinatesToLineIndex(Point position)
		{
			return WorldCoordinatesToLineIndex(position - new 
				Size(AutoScrollPosition));
		}
		protected override void OnMouseDown(MouseEventArgs e)
		{
			base.OnMouseDown(e);
			this.mouseDoubleClickPosition = new Point(e.X, e.Y);
		}

		protected override void OnDoubleClick(EventArgs e)
		{
			int i = PageCoordinatesToLineIndex(this.mouseDoubleClickPosition);
			if (i >= 0)
			{
				TextLineInformation lineToBeChanged = 
					(TextLineInformation)documentLines[i];
				lineToBeChanged.Text = lineToBeChanged.Text.ToUpper();
				Graphics dc = this.CreateGraphics();
				uint newWidth =(uint)dc.MeasureString(lineToBeChanged.Text, 
					mainFont).Width;
				if (newWidth > lineToBeChanged.Width)
					lineToBeChanged.Width = newWidth;
				if (newWidth+2*margin > this.documentSize.Width)
				{
					this.documentSize.Width = (int)newWidth;
					this.AutoScrollMinSize = this.documentSize;
				}
				Rectangle changedRectangle = new Rectangle(
					LineIndexToPageCoordinates(i), 
					new Size((int)newWidth, 
					(int)this.lineHeight));
				this.Invalidate(changedRectangle);
			}
			base.OnDoubleClick(e);
		}


		private void menuFilePrintPreview_Click(object sender, System.EventArgs e)
		{
			PrintPreviewDialog ppd = new PrintPreviewDialog();
			PrintDocument pd = new PrintDocument();
			pd.PrintPage += new PrintPageEventHandler
				(this.pd_PrintPage);
			ppd.Document = pd;
			ppd.ShowDialog();
		}

		private void menuFilePrint_Click(object sender, System.EventArgs e)
		{
			PrintDocument pd = new PrintDocument();
			pd.PrintPage += new PrintPageEventHandler
				(this.pd_PrintPage);
			pd.Print();
			MessageBox.Show(pd.PrinterSettings.PrinterName);
		}

		private void pd_PrintPage(object sender, PrintPageEventArgs e) 
		{
			float yPos = 0;
			float leftMargin = e.MarginBounds.Left;
			float topMargin = e.MarginBounds.Top;
			string line = null;

			// Calculate the number of lines per page.
			int linesPerPage = (int)(e.MarginBounds.Height / 
				mainFont.GetHeight(e.Graphics));
//			linesPerPage = 10;
			int lineNo = this.printingPageNo * linesPerPage;

			// Print each line of the file.
			int count = 0;
			while(count < linesPerPage && lineNo < this.nLines) 
			{
				line = ((TextLineInformation)this.documentLines[lineNo]).Text;
				yPos = topMargin + (count * mainFont.GetHeight(e.Graphics));
				e.Graphics.DrawString(line, mainFont, Brushes.Blue, 
					leftMargin, yPos, new StringFormat());
				lineNo++;
				count++;
			}

			// If more lines exist, print another page.
			if(this.nLines > lineNo)
				e.HasMorePages = true;
			else
				e.HasMorePages = false;
			printingPageNo++;
		}


	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产老女人精品毛片久久| 蜜臀国产一区二区三区在线播放| 欧美一区二区视频观看视频| 在线视频你懂得一区| 91视频在线观看| 99精品桃花视频在线观看| 成人涩涩免费视频| 91香蕉视频黄| 欧美日韩一区二区不卡| 欧美日韩国产中文| 欧美精品日韩综合在线| 91精品蜜臀在线一区尤物| 日韩一区二区三区四区| 精品久久久久久久久久久院品网| 久久亚洲欧美国产精品乐播| 久久久www免费人成精品| 国产欧美精品一区二区色综合朱莉| 国产日韩欧美综合一区| 中文字幕一区二区三区在线播放| 综合婷婷亚洲小说| 日韩高清国产一区在线| 国产精品亚洲а∨天堂免在线| 不卡影院免费观看| 91久久精品网| 日韩一本二本av| 亚洲同性同志一二三专区| 亚洲成人av免费| 精东粉嫩av免费一区二区三区| 福利电影一区二区三区| 91麻豆精品秘密| 日韩你懂的电影在线观看| 国产色产综合色产在线视频| 亚洲国产综合视频在线观看| 精品一二三四区| 91黄视频在线| 久久久99免费| 亚洲福利一区二区| 成人精品gif动图一区| 欧美高清视频一二三区 | 亚洲色图.com| 日韩影院在线观看| 成年人国产精品| 欧美成人官网二区| 亚洲国产日韩精品| 粉嫩一区二区三区在线看| 欧美日韩国产美女| 亚洲人妖av一区二区| 久久97超碰色| 欧美日韩精品一区二区三区| 成人欧美一区二区三区1314| 麻豆精品一区二区综合av| 欧美主播一区二区三区美女| 欧美激情综合五月色丁香小说| 免费在线看一区| 在线免费观看视频一区| √…a在线天堂一区| 国产xxx精品视频大全| 日韩情涩欧美日韩视频| 亚洲欧美成人一区二区三区| 国产精品66部| 久久久精品综合| 韩国理伦片一区二区三区在线播放| 欧美视频在线播放| 亚洲欧美另类久久久精品2019| 国产永久精品大片wwwapp| 日韩精品一区二区三区老鸭窝| 亚洲电影第三页| 在线看国产日韩| 亚洲综合色视频| 欧美日韩一区二区三区在线| 亚洲一区在线观看免费观看电影高清| 91亚洲精品乱码久久久久久蜜桃| 国产女人18毛片水真多成人如厕 | 一本色道a无线码一区v| 国产精品视频观看| 国产成人av网站| 日本一区二区三区国色天香| 国产a精品视频| 国产欧美一区二区三区在线老狼| 国产精品一级在线| 欧美国产精品一区二区三区| 从欧美一区二区三区| 国产精品久久免费看| 99久久er热在这里只有精品15| 国产精品视频第一区| 色噜噜狠狠一区二区三区果冻| 亚洲视频一二区| 色婷婷久久久久swag精品 | 91精品国产综合久久婷婷香蕉| 亚洲午夜激情网页| 日韩免费观看高清完整版在线观看| 视频一区二区中文字幕| 日韩一区二区三区视频在线观看| 久久精品72免费观看| 国产亚洲欧美日韩在线一区| 成人精品小蝌蚪| 一区二区视频免费在线观看| 欧美老年两性高潮| 久久精品噜噜噜成人88aⅴ| 中文字幕精品综合| 欧美无乱码久久久免费午夜一区| 婷婷开心激情综合| 精品88久久久久88久久久| 成人av影视在线观看| 亚洲国产精品自拍| 久久综合999| 日韩av电影天堂| 欧美日韩午夜精品| 亚洲精选一二三| 国产一区二区免费看| 不卡一区二区在线| 婷婷综合五月天| 国产欧美一区在线| 欧美精品一二三| 国产二区国产一区在线观看| 亚洲欧美区自拍先锋| 欧美zozo另类异族| 在线观看日韩电影| 国产成人av电影在线| 亚洲成av人在线观看| 国产精品天干天干在观线| 4438成人网| 色综合久久久久综合体桃花网| 久久精品国产精品亚洲综合| 亚洲自拍偷拍网站| 国产精品麻豆视频| 久久亚洲精品小早川怜子| 欧美精品久久久久久久多人混战 | 91黄色免费观看| 成人性色生活片免费看爆迷你毛片| 日韩和的一区二区| 亚洲综合色网站| 亚洲青青青在线视频| 久久亚洲精精品中文字幕早川悠里| 91久久精品国产91性色tv| 成人高清av在线| 国产九九视频一区二区三区| 日本视频一区二区三区| 天堂av在线一区| 午夜视频在线观看一区| 一区二区三区视频在线看| 亚洲视频香蕉人妖| 中文字幕一区在线| 国产精品视频线看| 国产精品久久久久久久久搜平片| 久久亚洲综合色| 久久久一区二区三区捆绑**| 日韩精品一区二区三区视频在线观看| 欧美性生活大片视频| 欧美日韩你懂的| 欧美日本一区二区| 91精品久久久久久久91蜜桃| 欧美精品日韩一区| 日韩一区二区影院| 精品美女一区二区三区| 欧美成人一区二区三区| 日韩欧美精品在线视频| 日韩一区国产二区欧美三区| 日韩一卡二卡三卡四卡| 精品国产3级a| 国产精品成人免费精品自在线观看| 国产精品欧美综合在线| 一区视频在线播放| 久久97超碰国产精品超碰| 亚洲精选免费视频| 青青草91视频| 国产精品无码永久免费888| 久久免费看少妇高潮| 欧美韩国一区二区| 中文字幕人成不卡一区| 国产欧美一区二区在线观看| 国产清纯白嫩初高生在线观看91| 国产精品网站在线播放| 亚洲精品写真福利| 日韩不卡一区二区三区| 免费在线观看日韩欧美| 国产一区二区三区最好精华液| 丰满岳乱妇一区二区三区| 99国产精品国产精品久久| 欧美日韩中文国产| 日韩一区二区三区精品视频| 国产欧美一区二区精品婷婷| 综合色天天鬼久久鬼色| 日韩va欧美va亚洲va久久| 蜜桃久久久久久| 国产精品88av| 欧美疯狂性受xxxxx喷水图片| 亚洲精品在线网站| 一级精品视频在线观看宜春院| 蜜桃精品视频在线| 成年人午夜久久久| 精品入口麻豆88视频| 亚洲精品老司机| 精品亚洲porn| 欧美综合视频在线观看| www国产成人| 午夜精品久久久久久久99樱桃| 狠狠色丁香婷婷综合久久片| 不卡大黄网站免费看| 在线播放欧美女士性生活|