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

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

?? menuitemdrawing.cs

?? 用C#實現office2003風格的菜單組件
?? CS
字號:
using System;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;

namespace Dev4Arabs
{
	/// <summary>
	/// This class has the methods to draw the MenuItems
	/// </summary>
	public class MenuItemDrawing
	{

		/// <summary>
		/// The main method that will draw the menu item
		/// </summary>
		public static void DrawMenuItem(System.Windows.Forms.DrawItemEventArgs e, MenuItem mi)
		{
			// check to see if the menu item is selected
			if ( (e.State & DrawItemState.Selected) == DrawItemState.Selected ) {
				// Draw selection rectangle
				DrawSelectionRect(e, mi);	
			} else {
				// if no selection, just draw white space
				e.Graphics.FillRectangle(new SolidBrush(Globals.MenuBgColor), e.Bounds);
				// Draw the picture area
				DrawPictureArea(e, mi);
			}

			// Draw check box if the menu item is checked
			if ( (e.State & DrawItemState.Checked) == DrawItemState.Checked ) {
				DrawCheckBox(e, mi);
			}

			// Draw the menuitem text
			DrawMenuText(e, mi);

			// Draw the item's picture
			DrawItemPicture(e, mi);

		}

		/// <summary>
		/// This method draws the menu's Text
		/// </summary>
		private static void DrawMenuText(System.Windows.Forms.DrawItemEventArgs e, MenuItem mi)
		{
			Brush textBrush = new SolidBrush(Globals.TextColor);

			// Draw the menu text
			// if the menu item is a seperator
			if ( mi.Text == "-" ) {
				// draw seperator line
				e.Graphics.DrawLine(new Pen(Globals.MenuLightColor), e.Bounds.X + Globals.PIC_AREA_SIZE + 3, e.Bounds.Y + 2, e.Bounds.Width, e.Bounds.Y + 2);
			} else {
				// create StringFormat object and set the alignment to center
				StringFormat sf = new StringFormat();
				sf.LineAlignment = StringAlignment.Center;

				// create the rectangle that will hold the text
				RectangleF rect = new Rectangle(Globals.PIC_AREA_SIZE + 2, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height);

				string miText = mi.Text.Replace("&","");

				// check the menuitem status
				if ( mi.Enabled )
					textBrush = new SolidBrush(Globals.TextColor);	
				else
					textBrush = new SolidBrush(Globals.TextDisabledColor);	
				
				// Draw the text
				e.Graphics.DrawString(miText, Globals.menuFont, textBrush, rect, sf);

				// Draw the shortcut text
				DrawShortCutText(e, mi);
			}
		}

		/// <summary>
		/// This method draws the shortcut text for a MenuItem
		/// </summary>
		private static void DrawShortCutText(System.Windows.Forms.DrawItemEventArgs e, MenuItem mi)
		{
			// check to see if there is a short cut for this item
			if ( mi.Shortcut != Shortcut.None && mi.ShowShortcut == true)
			{
				// get the shortcut text size
				SizeF scSize = 
					e.Graphics.MeasureString(mi.Shortcut.ToString(), 
					Globals.menuFont);

				// Create the text rectangle
				Rectangle rect = 
					new Rectangle(e.Bounds.Width - Convert.ToInt32(scSize.Width) - Globals.PIC_AREA_SIZE,
					e.Bounds.Y,
					Convert.ToInt32(scSize.Width) + 5,
					e.Bounds.Height);

				// set it to right-to-left, and center it
				StringFormat sf = new StringFormat();
				sf.FormatFlags = StringFormatFlags.DirectionRightToLeft;
				sf.LineAlignment = StringAlignment.Center;

				// draw the text
				if ( mi.Enabled )
					e.Graphics.DrawString(mi.Shortcut.ToString(), 
						Globals.menuFont, 
						new SolidBrush(Globals.TextColor), 
						rect, 
						sf);
				else {	
					// if menuItem is disabled
					e.Graphics.DrawString(mi.Shortcut.ToString(), 
						Globals.menuFont, 
						new SolidBrush(Globals.TextDisabledColor), 
						rect, 
						sf);
				}
			}
		}

		/// <summary>
		/// This method draws the picturebox area
		/// </summary>
		private static void DrawPictureArea(System.Windows.Forms.DrawItemEventArgs e, MenuItem mi)
		{
			// the picture area rectangle
			Rectangle rect = new Rectangle(e.Bounds.X - 1, 
				e.Bounds.Y, 
				Globals.PIC_AREA_SIZE, 
				e.Bounds.Height);

			// Create Gradient brush, using system colors
			Brush b = new LinearGradientBrush(rect, 
				Globals.MenuDarkColor2, 
				Globals.MenuLightColor2,
				180f, 
				false);

			// Draw the rect
			e.Graphics.FillRectangle(b, rect);
		}

		/// <summary>
		/// This method Draws the picture associated with a MenuItem
		/// </summary>
		private static void DrawItemPicture(System.Windows.Forms.DrawItemEventArgs e, MenuItem mi)
		{
			const int MAX_PIC_SIZE = 16;

			// Get the Item's picture
			Image img = OfficeMenus.GetItemPicture(mi);

			// check to see if the Item has a picture, if none, Ignore
			if ( img != null ) 
			{
				// if the size exceeds the maximum picture's size, fix it
				int width = img.Width > MAX_PIC_SIZE ? MAX_PIC_SIZE : img.Width;
				int height = img.Height > MAX_PIC_SIZE ? MAX_PIC_SIZE : img.Height;
				
				// set the picture coordinates
				int x = e.Bounds.X + 2;
				int y = e.Bounds.Y + ((e.Bounds.Height - height) / 2);
				
				// create the picture rectangle
				Rectangle rect = new Rectangle(x, y, width, height);
				
				// Now check the items state, if enabled just draw the picture
				// if not enabled, make a water mark and draw it.
				if ( mi.Enabled ) {
					// draw the image
					e.Graphics.DrawImage(img, x, y, width, height);
				} else {
					// make water mark of the picture
					ColorMatrix myColorMatrix = new ColorMatrix();
					myColorMatrix.Matrix00 = 1.00f; // Red
					myColorMatrix.Matrix11 = 1.00f; // Green
					myColorMatrix.Matrix22 = 1.00f; // Blue
					myColorMatrix.Matrix33 = 1.30f; // alpha
					myColorMatrix.Matrix44 = 1.00f; // w

					// Create an ImageAttributes object and set the color matrix.
					ImageAttributes imageAttr = new ImageAttributes();
					imageAttr.SetColorMatrix(myColorMatrix);

					// draw the image
					e.Graphics.DrawImage(img,
						rect,
						0, 
						0, 
						width, 
						height, 
						GraphicsUnit.Pixel, 
						imageAttr);
				}
			}
		}

		/// <summary>
		/// This method draws the selection rectangle
		/// </summary>
		private static void DrawSelectionRect(System.Windows.Forms.DrawItemEventArgs e, MenuItem mi)
		{
			// if the item is not enabled, then do not draw the selection rect
			if ( mi.Enabled ) 
			{
				// fill selection rectangle
				e.Graphics.FillRectangle(new SolidBrush(Globals.SelectionColor), 
					e.Bounds);

				// Draw borders
				e.Graphics.DrawRectangle(new Pen(Globals.MenuDarkColor), 
					e.Bounds.X, 
					e.Bounds.Y, 
					e.Bounds.Width - 1, 
					e.Bounds.Height - 1);
			}
		}

		/// <summary>
		/// This method draws a CheckBox for a MenuItem
		/// </summary>
		private static void DrawCheckBox(System.Windows.Forms.DrawItemEventArgs e, MenuItem mi)
		{
			// Define the CheckBox size
			int cbSize = Globals.PIC_AREA_SIZE - 5;

			// set the smoothing mode to anti alias
			e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;

			// the main rectangle
			Rectangle rect = new Rectangle(e.Bounds.X + 1, 
				e.Bounds.Y + ((e.Bounds.Height - cbSize) / 2), 
				cbSize, 
				cbSize);

			// construct the drawing pen
			Pen pen = new Pen(Color.Black,1.7f);

			// fill the rectangle
			if ( (e.State & DrawItemState.Selected) == DrawItemState.Selected )
				e.Graphics.FillRectangle(new SolidBrush(Globals.DarkCheckBoxColor), rect);
			else
				e.Graphics.FillRectangle(new SolidBrush(Globals.CheckBoxColor), rect);

			// draw borders
			e.Graphics.DrawRectangle(new Pen(Globals.MenuDarkColor), rect);
			
			// Check to see if the menuItem has a picture
			// if Yes, Do not draw the check mark; else, Draw it
			Bitmap img = OfficeMenus.GetItemPicture(mi);

			if ( img == null ) {
				// Draw the check mark
				e.Graphics.DrawLine(pen, e.Bounds.X + 7, 
					e.Bounds.Y + 10, 
					e.Bounds.X + 10, 
					e.Bounds.Y + 14);

				e.Graphics.DrawLine(pen, 
					e.Bounds.X + 10, 
					e.Bounds.Y + 14, 
					e.Bounds.X + 15, 
					e.Bounds.Y + 9);
			}
		}
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
午夜久久久久久久久| 亚洲国产另类av| 亚洲国产精品人人做人人爽| 国产一区二区三区四区五区美女| 麻豆91小视频| 亚洲欧洲99久久| 麻豆精品在线视频| 色综合婷婷久久| 久久久噜噜噜久久人人看| 午夜精品久久久久久久久久久| 东方欧美亚洲色图在线| 日韩免费高清av| 亚洲一级在线观看| 99久久伊人精品| 久久久久国产精品厨房| 日韩在线a电影| 欧美亚日韩国产aⅴ精品中极品| 国产精品乱人伦| 国产一区二区三区黄视频 | 国产亚洲女人久久久久毛片| 亚洲成人激情社区| 91视频一区二区| 国产精品视频一二三区| 久久99久久精品欧美| 欧美精品久久99| 天天免费综合色| 欧美二区三区91| 三级欧美韩日大片在线看| 在线免费一区三区| 亚洲三级理论片| 色av成人天堂桃色av| 中文字幕免费观看一区| 国产电影一区二区三区| 久久久久久久精| 高清不卡一区二区| 欧美—级在线免费片| 成人激情综合网站| 亚洲欧美日韩在线| 色综合视频在线观看| 亚洲制服丝袜av| 欧美老女人在线| 日韩二区三区在线观看| 91精品国产91久久久久久一区二区 | 最新日韩在线视频| 91在线一区二区三区| 中文字幕佐山爱一区二区免费| 97精品久久久午夜一区二区三区 | 2022国产精品视频| 韩国av一区二区三区在线观看 | 日韩一区二区电影| 久久精品国产亚洲高清剧情介绍| 日韩亚洲欧美在线| 国产一区二区三区四区五区美女 | 国产酒店精品激情| 欧美激情一二三区| 色综合欧美在线| 婷婷夜色潮精品综合在线| 日韩精品一区二区三区三区免费| 极品瑜伽女神91| 亚洲欧美综合在线精品| 欧美亚洲综合在线| 久久av老司机精品网站导航| 国产免费久久精品| 在线免费观看日本一区| 久久99国产精品成人| 中文字幕免费不卡| 91麻豆精品久久久久蜜臀| 国产剧情在线观看一区二区| 亚洲人成精品久久久久久| 337p亚洲精品色噜噜| 大胆亚洲人体视频| 天堂午夜影视日韩欧美一区二区| 久久久久久免费毛片精品| 91成人网在线| 精品制服美女久久| 中文字幕日韩欧美一区二区三区| 欧美区在线观看| 成人一级视频在线观看| 偷拍亚洲欧洲综合| 亚洲视频一区二区免费在线观看| 在线播放欧美女士性生活| 99热精品一区二区| 韩国欧美国产1区| 亚洲国产精品一区二区www| 亚洲国产精品成人综合色在线婷婷| 欧美日韩国产美| 99久久精品国产毛片| 国产一区免费电影| 日本中文字幕一区二区有限公司| 中文字幕一区二区三区四区| 欧美va亚洲va香蕉在线| 精品视频色一区| 91欧美一区二区| 国产不卡高清在线观看视频| 美女一区二区视频| 婷婷综合在线观看| 亚洲午夜在线视频| 亚洲精品v日韩精品| 国产人成亚洲第一网站在线播放 | 国产精品网站一区| 精品国产欧美一区二区| 欧美人狂配大交3d怪物一区 | 一区二区三区久久| 国产欧美日韩亚州综合| 精品日韩欧美一区二区| 91麻豆精品国产自产在线 | 99视频国产精品| 国产91清纯白嫩初高中在线观看 | 91色视频在线| 91在线观看污| 国产精品亚洲成人| 国产裸体歌舞团一区二区| 久久国产尿小便嘘嘘尿| 麻豆精品久久久| 老司机午夜精品| 久久疯狂做爰流白浆xx| 久久99热这里只有精品| 久久不见久久见免费视频1| 美日韩黄色大片| 国产一区二区主播在线| 国产一区二区三区免费播放| 国产精品69久久久久水密桃| 国产二区国产一区在线观看| 成人禁用看黄a在线| 一本色道久久综合亚洲91| 一本到三区不卡视频| 日本高清不卡视频| 欧美亚洲动漫另类| 欧美一区二区三区喷汁尤物| 欧美成人性福生活免费看| 精品国产一区久久| 国产精品嫩草99a| 亚洲日本在线a| 日日骚欧美日韩| 黄色日韩网站视频| 成人免费毛片a| 色网综合在线观看| 欧美美女直播网站| 久久久久国产免费免费 | 午夜视频一区二区| 老鸭窝一区二区久久精品| 狠狠色狠狠色合久久伊人| 本田岬高潮一区二区三区| 欧美性感一类影片在线播放| 日韩欧美一区二区视频| 欧美高清在线一区二区| 自拍偷拍欧美精品| 日韩av电影天堂| 国产成人精品亚洲午夜麻豆| 色婷婷激情综合| 精品日产卡一卡二卡麻豆| 国产精品福利av| 蜜桃视频一区二区| 成人av网站免费| 这里只有精品电影| 综合激情成人伊人| 国产综合成人久久大片91| 99re在线精品| 日韩精品一区二区三区蜜臀| 亚洲蜜桃精久久久久久久| 麻豆成人久久精品二区三区小说| 99天天综合性| 精品国产乱码久久久久久老虎 | 青青草国产精品97视觉盛宴| 成人做爰69片免费看网站| 欧美久久久久免费| 亚洲欧美激情小说另类| 国产精品中文欧美| 在线不卡免费欧美| 亚洲自拍偷拍欧美| 99在线精品视频| 久久久美女毛片| 日韩精品视频网站| 在线一区二区三区四区五区| 中文字幕第一页久久| 捆绑调教一区二区三区| 欧美日韩五月天| 一区二区理论电影在线观看| 丁香激情综合国产| 久久综合九色综合97婷婷女人 | 欧美日韩国产高清一区二区三区 | 色综合久久中文综合久久牛| 2020日本不卡一区二区视频| 午夜精品福利在线| 在线影视一区二区三区| 中文字幕一区二区三区四区| 国产一区二区在线观看免费| 欧美一级久久久| 一区二区免费在线播放| 亚洲欧洲日韩女同| 国产成人自拍网| 一区精品在线播放| 亚洲国产精品v| 黑人巨大精品欧美黑白配亚洲| 欧美三级视频在线播放| 中文字幕在线不卡| 成人aa视频在线观看| 久久精品一区二区三区不卡牛牛| 精品一区二区三区免费| 精品捆绑美女sm三区|