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

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

?? officemenus.cs

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


namespace Dev4Arabs
{
	/// <summary>
	/// Summary description for OfficeMenus.
	/// </summary>
	[ToolboxBitmap (typeof(OfficeMenus), "Dev4Arabs.OfficeMenus.bmp")]
	public class OfficeMenus : System.ComponentModel.Component
	{
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		static ImageList _imageList;

		// Collection that holds the pictures details
		static NameValueCollection picDetails = new NameValueCollection();

		public OfficeMenus(System.ComponentModel.IContainer container)
		{
			///
			/// Required for Windows.Forms Class Composition Designer support
			///
			container.Add(this);
			InitializeComponent();

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

		public OfficeMenus()
		{
			///
			/// Required for Windows.Forms Class Composition Designer support
			///
			InitializeComponent();

			//
			// 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 );
		}

		#region Component 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()
		{
			components = new System.ComponentModel.Container();
		}
		#endregion

		/// <summary>
		/// This method start the proccess of changing the
		/// menus look to that of Office 2003
		/// </summary>
		/// <param name="form"></param>
		public void Start(Form form)
		{
			try 
			{
				//************************************
				// Main menu
				//************************************
				
				// Get the main menu from the parent form
				System.Windows.Forms.MainMenu menu = form.Menu;

				// loop through all MenuItem controls, adding the event handlers
				foreach ( MenuItem mi in menu.MenuItems )
				{
					// Add MesaureItem event handler
					mi.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(mainMenuItem_MeasureItem);
					// Add DrawItem event handler
					mi.DrawItem += new System.Windows.Forms.DrawItemEventHandler(mainMenuItem_DrawItem);
					// Set the OwnerDraw property to true
					mi.OwnerDraw = true;
					
					// call InitMenuItem Method to apply changes to child menus
					InitMenuItem(mi);
				}

				//**************************************
				// Context menus
				//**************************************

				// Parent Form context menu
				ContextMenu cmenu = form.ContextMenu;
				if ( cmenu != null ) {
					InitMenuItem(cmenu);
				}

				// Now all context menus for all controls in the Form
				foreach ( Control c in form.Controls ) 
				{
					if ( c.ContextMenu != null )
						InitMenuItem(c.ContextMenu);
				}

			}
			catch {}
		}

		/// <summary>
		/// This method Ends the proccess of changing the
		/// menus look to that of Office 2003
		/// </summary>
		/// <param name="form"></param>
		public void End(Form form)
		{
			try 
			{
				//************************************
				// Main menu
				//************************************
				
				// Get the main menu from the parent form
				System.Windows.Forms.MainMenu menu = form.Menu;

				// loop through all MenuItem controls, Removing the event handlers
				foreach ( MenuItem mi in menu.MenuItems )
				{
					// Remove MesaureItem event handler
					mi.MeasureItem -= new System.Windows.Forms.MeasureItemEventHandler(mainMenuItem_MeasureItem);
					// Remove DrawItem event handler
					mi.DrawItem -= new System.Windows.Forms.DrawItemEventHandler(mainMenuItem_DrawItem);
					// Set the OwnerDraw property to false
					mi.OwnerDraw = false;
					
					// call UninitMenuItem Method to Remove changes from child menus
					UninitMenuItem(mi);
				}

				//**************************************
				// Context menus
				//**************************************

				// Parent Form context menu
				ContextMenu cmenu = form.ContextMenu;
				if ( cmenu != null ) 
				{
					UninitMenuItem(cmenu);
				}

				// Now all context menus for all controls in the Form
				foreach ( Control c in form.Controls ) 
				{
					if ( c.ContextMenu != null )
						UninitMenuItem(c.ContextMenu);
				}

			}
			catch {}
		}

		/// <summary>
		/// This method add event handlers to MesaureItem event and 
		/// DrawItem event, and changed the OwnerDraw property to true.
		/// after calling this method for a menu, the menu will look like 
		/// Office 2003 menus
		/// </summary>
		/// <param name="mi">The Menu to apply changes for</param>
		private void InitMenuItem(Menu mi)
		{
			foreach ( MenuItem m in mi.MenuItems )
			{
				// Add MesaureItem event handler
				m.MeasureItem += 
					new System.Windows.Forms.MeasureItemEventHandler(this.menuItem_MeasureItem);
				// Add DrawItem event handler
				m.DrawItem += 
					new System.Windows.Forms.DrawItemEventHandler(this.menuItem_DrawItem);
				// Set the OwnerDraw property to true
				m.OwnerDraw = true;

				// Recall the same method again to apply the changes
				// to the child menus
				InitMenuItem(m);
			}
		}

		/// <summary>
		/// This method Remove all changes to the menus
		/// </summary>
		/// <param name="mi">the menu too remove changes from</param>
		private void UninitMenuItem(Menu mi)
		{
			foreach ( MenuItem m in mi.MenuItems )
			{
				// Remove MesaureItem event handler
				m.MeasureItem -= 
					new System.Windows.Forms.MeasureItemEventHandler(this.menuItem_MeasureItem);
				// Remove DrawItem event handler
				m.DrawItem -= 
					new System.Windows.Forms.DrawItemEventHandler(this.menuItem_DrawItem);
				// Set the OwnerDraw property to false
				m.OwnerDraw = false;

				// Recall the same method again to Remove the changes
				// from the child menus
				UninitMenuItem(m);
			}
		}

		/// <summary>
		/// This is the event for mesauring the MenuItem size
		/// this will only be added for MenuItems and ContextMenus
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void menuItem_MeasureItem(object sender, System.Windows.Forms.MeasureItemEventArgs e)
		{
			MenuItem mi = (MenuItem) sender;
			// if the item is a seperator
			if ( mi.Text == "-" ) {
				e.ItemHeight = 7;
			} else {
				// get the item's text size
				SizeF miSize = e.Graphics.MeasureString(mi.Text, Globals.menuFont);
				int scWidth = 0;
				// get the short cut width
				if ( mi.Shortcut != Shortcut.None ) {
					SizeF scSize = e.Graphics.MeasureString(mi.Shortcut.ToString(), Globals.menuFont);
					scWidth = Convert.ToInt32(scSize.Width);
				}
				// set the bounds
				int miHeight = Convert.ToInt32(miSize.Height) + 7;
				if (miHeight < 25) miHeight = Globals.MIN_MENU_HEIGHT;
				e.ItemHeight = miHeight;
				e.ItemWidth = Convert.ToInt32(miSize.Width) + scWidth + (Globals.PIC_AREA_SIZE * 2);
			}
		}

		/// <summary>
		/// The event for drawing menuItems, this will be called for
		/// MenuItems and ContextMenus
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void menuItem_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
		{
			// Draw Menu Item
			MenuItemDrawing.DrawMenuItem(e, (MenuItem) sender);
		}

		/// <summary>
		/// This is the event for mesauring the MenuItem size
		/// this will only be added for Main MenuItems
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void mainMenuItem_MeasureItem(object sender, System.Windows.Forms.MeasureItemEventArgs e)
		{
			MenuItem mi = (MenuItem) sender;
			SizeF miSize = e.Graphics.MeasureString(mi.Text, Globals.menuFont);
			e.ItemWidth = Convert.ToInt32(miSize.Width);
		}

		/// <summary>
		/// The event for drawing menuItems, this will only be called for
		/// Main MenuItems
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void mainMenuItem_DrawItem(object sender, System.Windows.Forms.DrawItemEventArgs e)
		{
			// Draw the main menu item
			MainMenuItemDrawing.DrawMenuItem(e, (MenuItem) sender);
		}

		// ************************************
		// Public Methods
		// ************************************
		/// <summary>
		/// Adds a picture to a MenuItem
		/// </summary>
		/// <param name="mi">The menuItem to add picture to</param>
		/// <param name="index">The index of the Picture in the ImageList</param>
		public void AddPicture(MenuItem mi, int index)
		{
			picDetails.Add(mi.Handle.ToString(), index.ToString());
		}

		/// <summary>
		/// Gets a MenuItem's Picure
		/// </summary>
		/// <param name="mi">The MenuItem to get it's picture</param>
		/// <returns>A Bitmap object contains the picture
		/// null in case no picture for this MenuItem
		/// </returns>
		public static Bitmap GetItemPicture(MenuItem mi)
		{
			if ( _imageList == null )
				return null;

			string [] picIndex = picDetails.GetValues(mi.Handle.ToString());
			
			if ( picIndex == null )
				return null;
			else
				return (Bitmap)_imageList.Images[Convert.ToInt32(picIndex[0])];
		}

		//*************************************
		// Public Properties
		//*************************************
		/// <summary>
		/// The ImageList which will hold the MenuItems pictures
		/// </summary>
		public ImageList ImageList
		{
			get { return _imageList; }
			set { _imageList = value; }
		}
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美一区二区三区在线电影| 性做久久久久久免费观看欧美| 日韩女优毛片在线| 欧美美女一区二区三区| 欧美在线高清视频| 欧美巨大另类极品videosbest | 国产精品理论在线观看| 国产清纯白嫩初高生在线观看91 | 久久er99精品| 激情图片小说一区| 国产成人免费网站| 北条麻妃一区二区三区| 91麻豆精东视频| 欧洲亚洲精品在线| 欧美色老头old∨ideo| 色哦色哦哦色天天综合| 欧美怡红院视频| 欧美一区二区三区视频| 精品久久久久久久久久久久久久久久久| 91精品一区二区三区久久久久久| 日韩一区二区在线观看视频| 久久综合狠狠综合久久激情| 国产精品无圣光一区二区| 亚洲精品中文字幕在线观看| 亚洲欧美一区二区视频| 亚洲精品国产成人久久av盗摄| 一级精品视频在线观看宜春院| 亚洲第四色夜色| 激情综合色播激情啊| 国产一区二区三区免费| 色综合久久综合中文综合网| 91精品久久久久久久91蜜桃| 精品成人a区在线观看| 国产精品久久综合| 天堂av在线一区| 国产精品综合一区二区| 91啪亚洲精品| 日韩欧美中文一区二区| 国产精品午夜在线观看| 亚洲香蕉伊在人在线观| 精品系列免费在线观看| 91在线观看视频| 欧美一区二区在线看| 国产欧美精品一区| 午夜视频在线观看一区| 国产精品66部| 欧美久久久久久久久中文字幕| 久久综合九色综合欧美就去吻| 亚洲同性同志一二三专区| 午夜精品久久久久久| 国产伦理精品不卡| 日本高清无吗v一区| 精品国产一区a| 亚洲一区电影777| 国产成人免费9x9x人网站视频| 欧美视频在线一区| 国产视频一区二区在线| 亚洲一区在线观看视频| 国产乱人伦偷精品视频免下载 | 亚洲精品成人在线| 精品一区二区av| 欧美影视一区二区三区| 国产欧美综合色| 免费在线观看成人| 色香蕉成人二区免费| 久久综合九色综合97婷婷| 亚洲福利一二三区| 成年人国产精品| 日韩欧美国产午夜精品| 亚洲精品久久7777| 不卡一区二区中文字幕| 欧美成人性福生活免费看| 亚洲第一成人在线| 色哟哟欧美精品| 国产精品免费视频一区| 久久狠狠亚洲综合| 在线不卡中文字幕播放| 亚洲欧美色综合| 成人免费观看视频| 久久综合九色综合久久久精品综合| 亚洲成人7777| 在线观看日产精品| 亚洲人成在线播放网站岛国| 丁香亚洲综合激情啪啪综合| 久久综合九色综合欧美亚洲| 六月丁香婷婷色狠狠久久| 欧美日韩成人在线一区| 亚洲综合无码一区二区| 一本久道久久综合中文字幕| 国产精品素人一区二区| 国产精品资源在线看| 欧美r级电影在线观看| 理论电影国产精品| 欧美电影影音先锋| 午夜精品爽啪视频| 欧美精品vⅰdeose4hd| 亚洲成av人影院在线观看网| 欧洲另类一二三四区| 亚洲综合男人的天堂| 91福利在线看| 亚洲自拍偷拍综合| 欧美人伦禁忌dvd放荡欲情| 亚洲一区二区三区美女| 欧美日韩一级黄| 亚洲h精品动漫在线观看| 欧美日韩精品电影| 天天综合网 天天综合色| 这里只有精品电影| 丝袜脚交一区二区| 日韩欧美中文字幕精品| 国产自产高清不卡| 国产欧美1区2区3区| 成人国产精品免费观看| 中文字幕制服丝袜成人av | 欧美一级国产精品| 麻豆视频观看网址久久| 日韩女同互慰一区二区| 精东粉嫩av免费一区二区三区| 精品国精品国产尤物美女| 国内精品伊人久久久久av一坑| 国产日韩欧美激情| 91在线视频免费观看| 亚洲一区二区欧美激情| 91精品国产入口| 国产精品综合av一区二区国产馆| 国产精品私房写真福利视频| av不卡在线播放| 午夜成人免费电影| 久久婷婷国产综合国色天香| aaa亚洲精品| 亚洲成人免费观看| 精品国产一区二区在线观看| 成人亚洲一区二区一| 一区二区三区国产精华| 日韩欧美成人一区| 成人免费av资源| 亚洲国产毛片aaaaa无费看| 欧美成人r级一区二区三区| 国产成人精品免费在线| 一区二区视频免费在线观看| 欧美一区二区三区视频| 成人av电影在线| 日韩不卡手机在线v区| 久久久久久久久99精品| 日本韩国欧美国产| 国产一区二区三区久久久| 亚洲精品成a人| 欧美sm极限捆绑bd| 欧美中文字幕亚洲一区二区va在线| 久久99国产精品麻豆| 亚洲婷婷国产精品电影人久久| 欧美一区二区成人6969| 成人sese在线| 免费看日韩a级影片| 国产精品久久久久久户外露出| 欧美日本高清视频在线观看| 国产成人午夜片在线观看高清观看| 一区二区在线观看视频在线观看| 日韩欧美国产午夜精品| 91国偷自产一区二区三区观看 | av不卡免费在线观看| 蜜臀av性久久久久av蜜臀妖精| 亚洲欧美综合在线精品| 欧美成人一区二区三区片免费| 在线观看日韩av先锋影音电影院| 国产乱子伦一区二区三区国色天香 | 亚洲激情在线激情| 久久亚洲影视婷婷| 欧美日韩精品一区二区三区四区| 国产盗摄精品一区二区三区在线| 丝袜亚洲精品中文字幕一区| 亚洲天堂a在线| 国产亚洲福利社区一区| 日韩一区二区在线观看视频| 欧洲精品中文字幕| 成人精品一区二区三区中文字幕| 美女尤物国产一区| 亚洲大型综合色站| 亚洲免费伊人电影| 国产精品免费久久久久| 精品福利在线导航| 69堂国产成人免费视频| 91黄视频在线观看| 91在线精品秘密一区二区| 国产寡妇亲子伦一区二区| 日韩av电影天堂| 亚洲一区二区三区国产| 亚洲激情图片一区| 亚洲人成亚洲人成在线观看图片| 国产偷国产偷亚洲高清人白洁| 日韩精品中午字幕| 欧美精品一级二级三级| 欧美视频一区二区三区四区| 91丝袜国产在线播放| 成人激情图片网| 成人国产精品视频| www..com久久爱| 99国产欧美另类久久久精品| 波多野洁衣一区| 不卡一区二区在线|