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

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

?? form1.cs

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

namespace Wrox.ProCSharp.GdiPlus.CapsEditor
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		


	  #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

      #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();
		private System.Windows.Forms.MainMenu mainMenu1;
		private System.Windows.Forms.MenuItem menuFile;
		private System.Windows.Forms.MenuItem menuOpen;
		private System.Windows.Forms.MenuItem menuExit; 
		// standard open file dialog
		private bool documentHasData = false; 
		// set to true if document has some data in it
      #endregion

		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();
			this.BackColor = Color.White; 
			this.Text = "Caps Editor";
			CreateFonts();
			fileOpenDialog.FileOk += new 
				System.ComponentModel.CancelEventHandler(
				this.OpenFileDialog_FileOk);
			fileOpenDialog.Filter =
				"Text files (*.txt)|*.txt|C# source files (*.cs)|*.cs";
 

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}
		private void CreateFonts()
		{
			mainFont = new Font("Arial", 10);
			lineHeight = (uint)mainFont.Height;
			emptyDocumentFont = new Font("Verdana", 13, FontStyle.Bold);
		}


		class TextLineInformation
		{
			public string Text;
			public uint Width;
		}
		protected void OpenFileDialog_FileOk(object Sender, CancelEventArgs e)
		{
			this.LoadFile(fileOpenDialog.FileName);
		}

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

		protected void menuFileExit_Click(object sender, EventArgs e)
		{
			this.Close();
		}
		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();
			documentHasData = (nLines>0) ? true : 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)
		{
			base.OnPaint(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));
			}
		}
		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);
		}


		#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.menuOpen = new System.Windows.Forms.MenuItem();
			this.menuExit = 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.menuOpen,
																					 this.menuExit});
			this.menuFile.Text = "File";
			// 
			// menuOpen
			// 
			this.menuOpen.Index = 0;
			this.menuOpen.Text = "Open";
			this.menuOpen.Click += new System.EventHandler(this.menuFileOpen_Click);
			// 
			// menuExit
			// 
			this.menuExit.Index = 1;
			this.menuExit.Text = "Exit";
			this.menuExit.Click += new System.EventHandler(this.menuFileExit_Click);
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(292, 273);
			this.Menu = this.mainMenu1;
			this.Name = "Form1";
			this.Text = "Form1";

		}
		#endregion

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

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩电影在线一区二区三区| 久久成人综合网| 麻豆精品国产91久久久久久| 国产成人精品亚洲777人妖 | 亚洲a一区二区| 国产精品1区二区.| 在线成人午夜影院| 综合久久综合久久| 高清av一区二区| 欧美成人三级电影在线| 亚洲国产精品欧美一二99| 国产不卡在线播放| 久久免费视频一区| 久久福利资源站| 欧美一区二区三区喷汁尤物| 一区二区三区av电影 | 日本一二三四高清不卡| 美国欧美日韩国产在线播放| 欧美裸体bbwbbwbbw| 亚洲午夜精品在线| 日本韩国一区二区| 亚洲最大成人综合| 色偷偷久久一区二区三区| 国产精品国产a| 国产精品白丝av| 久久久久久久久97黄色工厂| 韩国午夜理伦三级不卡影院| 日韩视频在线一区二区| 免费在线欧美视频| 日韩三级伦理片妻子的秘密按摩| 日韩黄色一级片| 欧美一区二区三区视频在线| 免费在线看成人av| 精品国产欧美一区二区| 国模冰冰炮一区二区| 久久久久久毛片| 国产99精品在线观看| 国产精品五月天| 91亚洲精华国产精华精华液| 有坂深雪av一区二区精品| 欧美日韩在线综合| 日本欧美大码aⅴ在线播放| 日韩一区二区中文字幕| 久久99国产乱子伦精品免费| 久久夜色精品一区| 不卡电影免费在线播放一区| 亚洲欧美日韩电影| 9191精品国产综合久久久久久 | 日韩精品一区二区三区蜜臀| 蜜桃91丨九色丨蝌蚪91桃色| 久久久综合精品| 99久久综合国产精品| 亚洲国产综合色| 欧美一级国产精品| 丁香天五香天堂综合| 亚洲三级小视频| 日韩欧美激情一区| 成人av在线播放网址| 一区二区三区四区在线播放| 欧美一级爆毛片| 成人小视频免费在线观看| 一区二区三区日韩欧美| 日韩欧美综合在线| 99久久综合国产精品| 日韩av在线发布| 国产精品电影一区二区| 欧美日本在线观看| 国产经典欧美精品| 亚洲不卡一区二区三区| 国产日韩欧美精品电影三级在线| 色欧美乱欧美15图片| 久久丁香综合五月国产三级网站| √…a在线天堂一区| 精品国产青草久久久久福利| 91麻豆国产香蕉久久精品| 蜜臀av国产精品久久久久| 国产精品短视频| 精品久久一区二区| 欧美日韩在线免费视频| 国产在线精品免费| 天天av天天翘天天综合网| 欧美国产视频在线| 日韩午夜激情免费电影| 欧美亚日韩国产aⅴ精品中极品| 国产精品一区久久久久| 日韩精品一级中文字幕精品视频免费观看| 国产亚洲综合在线| 日韩精品最新网址| 欧美精品三级在线观看| 99在线视频精品| 国v精品久久久网| 老司机午夜精品| 天天综合日日夜夜精品| 一区二区三区国产| 亚洲欧美在线视频| 国产日韩欧美在线一区| 2017欧美狠狠色| 日韩视频国产视频| 欧美色手机在线观看| av福利精品导航| 国产99一区视频免费| 国产综合久久久久影院| 青青草一区二区三区| 五月天欧美精品| 天天综合色天天综合色h| 亚洲一二三专区| 亚洲影院久久精品| 亚洲国产精品欧美一二99| 亚洲一级在线观看| 亚洲第一福利视频在线| 亚洲成人先锋电影| 日韩制服丝袜先锋影音| 日韩黄色片在线观看| 午夜久久久影院| 日韩在线一区二区三区| 午夜电影一区二区| 日本视频免费一区| 经典三级一区二区| 国产成人啪午夜精品网站男同| 国产一区二区三区在线看麻豆| 国产专区欧美精品| 懂色av一区二区在线播放| av电影在线观看一区| 欧美做爰猛烈大尺度电影无法无天| 日本道在线观看一区二区| 欧美日韩久久久一区| 日韩欧美国产系列| 久久精品在线观看| 中文字幕一区二区三区乱码在线| 亚洲免费av网站| 天天av天天翘天天综合网| 激情综合色综合久久综合| 国产一区二区三区观看| 国产成人精品影视| 在线观看亚洲一区| 欧美一区二区三区日韩| 国产欧美va欧美不卡在线| 亚洲女女做受ⅹxx高潮| 丝袜亚洲另类欧美综合| 国产一区二区美女诱惑| 91色porny| 日韩一二三区视频| 亚洲欧洲av一区二区三区久久| 亚洲综合在线视频| 久久国产尿小便嘘嘘尿| 99视频有精品| 欧美一区二区三区电影| 国产精品美女视频| 日本亚洲欧美天堂免费| av成人免费在线观看| 欧美老人xxxx18| 中文字幕久久午夜不卡| 午夜不卡av在线| 国产91精品久久久久久久网曝门| 在线观看免费视频综合| 精品福利一区二区三区免费视频| 国产精品色噜噜| 久久99精品国产91久久来源| 91免费看片在线观看| 日韩免费一区二区| 亚洲影视在线播放| 成人国产电影网| 欧美岛国在线观看| 亚洲影视资源网| 成人一区二区三区在线观看| 欧美一区二区女人| 亚洲免费观看高清完整版在线| 国产一区二区三区久久久 | 日本免费在线视频不卡一不卡二| 菠萝蜜视频在线观看一区| 日韩免费高清视频| 午夜av区久久| 欧美mv日韩mv| 午夜日韩在线观看| 色综合久久天天综合网| 久久久精品免费观看| 老司机午夜精品| 日韩一区二区三区四区五区六区| 最新欧美精品一区二区三区| 国产麻豆成人精品| 日韩欧美专区在线| 日韩激情一二三区| 欧美群妇大交群中文字幕| 亚洲激情自拍偷拍| 粉嫩av一区二区三区粉嫩| 精品国产乱码久久久久久牛牛 | 亚洲欧美一区二区久久| 国产美女主播视频一区| 日韩欧美一区二区久久婷婷| 天天综合日日夜夜精品| 欧美日本国产一区| 亚洲v中文字幕| 欧美丰满少妇xxxxx高潮对白| 亚洲综合999| 欧洲精品中文字幕| 亚洲国产精品欧美一二99| 欧美三级在线看| 日本不卡中文字幕| 欧美一区二区三区色| 免费在线观看日韩欧美|