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

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

?? menucontrol.cs

?? chaoshi guan li xitong
?? CS
?? 第 1 頁 / 共 3 頁
字號:
using System;
using System.IO;
using System.Drawing;
using System.Reflection;
using System.Collections;
using System.Drawing.Text;
using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing.Imaging;
using UtilityLibrary.Win32;
using UtilityLibrary.Menus;
using UtilityLibrary.General;
using UtilityLibrary.Collections;


namespace UtilityLibrary.Menus
{
	[ToolboxBitmap(typeof(MenuControl))]
	[DefaultProperty("MenuCommands")]
	[DefaultEvent("PopupStart")]
	[Designer(typeof(UtilityLibrary.Menus.MenuControlDesigner))]
	public class MenuControl : ContainerControl, IMessageFilter
	{
		// Class constants
		protected const int _breadthGap = 5;
		protected const int _lengthGap = 3;
		protected const int _boxExpandUpper = 1;
		protected const int _boxExpandSides = 2;
		protected const int _shadowGap = 3;
		protected const int _shadowYOffset = 3;
		protected const int _separatorWidth = 15;
		protected const int _subMenuBorderAdjust = 2;
		protected const int _chevronIndex = 0;
		protected const int _chevronLength = 10;
		protected const int _chevronBreadth = 10;

		// Class constant is marked as 'readonly' to allow non constant initialization
		protected readonly int WM_OPERATEMENU = (int)Win32.Msg.WM_USER + 1;

		// Class fields
		protected static ImageList _menuImages = null;
		protected static bool _supportsLayered = false;

		// Declare the popup change event signature
		public delegate void PopupHandler(MenuCommand item);

		// Instance fields
		protected int _rowWidth;
		protected int _rowHeight;
		protected bool _selected;
		protected int _trackItem;
		protected bool _multiLine;
		protected bool _mouseOver;
		protected IntPtr _oldFocus;
		protected bool _manualFocus;
		protected bool _drawUpwards;
		protected VisualStyle _style;
		protected bool _plainAsBlock;
		protected Direction _direction;
		protected bool _ignoreEscapeUp;
		protected PopupMenu _popupMenu;
		protected bool _dismissTransfer;
		protected bool _ignoreMouseMove;
		protected ArrayList _drawCommands;
		protected MenuCommand _chevronStartCommand;
		protected MenuCommandCollection _menuCommands;

		// Instance fields - events
		public event PopupHandler PopupStart;
		public event PopupHandler PopupEnd;

		static MenuControl()
		{
			// Create a strip of images by loading an embedded bitmap resource
			_menuImages = ResourceUtil.LoadImageListResource(Type.GetType("UtilityLibrary.Menus.MenuControl"),
														 "Resources.ImagesMenu",
														 "MenuControlImages",
														 new Size(_chevronLength, _chevronBreadth),
				                                         true,
														 new Point(0,0));

			// We need to know if the OS supports layered windows
			_supportsLayered = (OSFeature.Feature.GetVersionPresent(OSFeature.LayeredWindows) != null);
		}

		public MenuControl()
		{
			// Set default values
			this.Dock = DockStyle.Top;
			_trackItem = -1;
			_selected = false;
			_multiLine = false;
			_popupMenu = null;
			_mouseOver = false;
			_manualFocus = false;
			_drawUpwards = false;
			_plainAsBlock = false;
			_oldFocus = IntPtr.Zero;
			_ignoreEscapeUp = false;
			_ignoreMouseMove = false;
			_dismissTransfer = false;
			_style = VisualStyle.IDE;
			_chevronStartCommand = null;
			_direction = Direction.Horizontal;
			_menuCommands = new MenuCommandCollection();
			
			// Prevent flicker with double buffering and all painting inside WM_PAINT
			SetStyle(ControlStyles.DoubleBuffer, true);
			SetStyle(ControlStyles.AllPaintingInWmPaint, true);

			// Should not be allowed to select this control
			SetStyle(ControlStyles.Selectable, false);

			// Hookup to collection events
			_menuCommands.Cleared += new CollectionWithEvents.CollectionClear(OnCollectionCleared);
			_menuCommands.Inserted += new CollectionWithEvents.CollectionChange(OnCollectionInserted);
			_menuCommands.Removed += new CollectionWithEvents.CollectionChange(OnCollectionRemoved);

			// Set the default menu color as background
			this.BackColor = SystemColors.Control;

			// Do not allow tab key to select this control
			this.TabStop = false;

			// Default the Font we use
			this.Font = SystemInformation.MenuFont;

			// Calculate the initial height/width of the control
			_rowWidth = _rowHeight = this.Font.Height + _breadthGap * 2 + 1;

			// Default to one line of items
			this.Height = _rowHeight;

			// Add ourself to the application filtering list
			Application.AddMessageFilter(this);
		}

		[Category("Behaviour")]
		[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
		public MenuCommandCollection MenuCommands
		{
			get { return _menuCommands; }

			set
			{
				_menuCommands.Clear();
				_menuCommands = value;

				Recalculate();
				Invalidate();
			}
		} 

		[Category("Appearance")]
		public VisualStyle Style
		{
			get { return _style; }
			
			set
			{
				if (_style != value)
				{
					_style = value;

					Recalculate();
					Invalidate();
				}
			}
		}

		[Category("Appearance")]
		public override Font Font
		{
			get { return base.Font; }
			
			set
			{
				base.Font = value;

				// Resize to take into accout the new height
				_rowHeight = this.Font.Height + _lengthGap * 2;

				Recalculate();
				Invalidate();
			}
		}

		[Category("Appearance")]
		[DefaultValue(false)]
		public bool PlainAsBlock
		{
			get { return _plainAsBlock; }

			set
			{
				if (_plainAsBlock != value)
				{
					_plainAsBlock = value;

					Recalculate();
					Invalidate();
				}
			}
		}

		[Category("Appearance")]
		[DefaultValue(false)]
		public bool MultiLine
		{
			get { return _multiLine; }

			set
			{
				if (_multiLine != value)
				{
					_multiLine = value;

					Recalculate();
					Invalidate();
				}
			}
		}

		[Category("Appearance")]
		public Direction Direction
		{
			get { return _direction; }

			set
			{
				if (_direction != value)
				{
					_direction = value;

					Recalculate();
					Invalidate();
				}
			}
		}

		public override DockStyle Dock
		{
			get { return base.Dock; }

			set
			{
				base.Dock = value;

				switch(value)
				{
				case DockStyle.None:
					_direction = Direction.Horizontal;
					break;
				case DockStyle.Top:
				case DockStyle.Bottom:
					this.Height = 0;
					_direction = Direction.Horizontal;
					break;
				case DockStyle.Left:
				case DockStyle.Right:
					this.Width = 0;
					_direction = Direction.Vertical;
					break;
				}

				Recalculate();
				Invalidate();
			}
		}

		protected void OnPopupStart(MenuCommand mc)
		{
			if (PopupStart != null)
				PopupStart(mc);
		}
		
		protected void OnPopupEnd(MenuCommand mc)
		{
			if (PopupEnd != null)
				PopupEnd(mc);
		}

		protected void OnCollectionCleared()
		{
			// Reset state ready for a recalculation
			_selected = false;
			_trackItem = -1;

			Recalculate();
			Invalidate();
		}

		protected void OnCollectionInserted(int index, object value)
		{
			MenuCommand mc = value as MenuCommand;

			// We need notification whenever the properties of this command change
			mc.PropertyChanged += new MenuCommand.PropChangeHandler(OnCommandChanged);
				
			// Reset state ready for a recalculation
			_selected = false;
			_trackItem = -1;

			Recalculate();
			Invalidate();
		}

		protected void OnCollectionRemoved(int index, object value)
		{
			// Reset state ready for a recalculation
			_selected = false;
			_trackItem = -1;

			Recalculate();
			Invalidate();
		}

		protected void OnCommandChanged(MenuCommand item, MenuCommand.Property prop)
		{
			Recalculate();
			Invalidate();
		}

		protected override void OnMouseDown(MouseEventArgs e)
		{
			Point pos = new Point(e.X, e.Y);

			for(int i=0; i<_drawCommands.Count; i++)
			{
				DrawCommand dc = _drawCommands[i] as DrawCommand;

				// Find the DrawCommand this is over
				if (dc.DrawRect.Contains(pos))
				{
					// Is an item already selected?
					if (_selected)
					{
						// Is it this item that is already selected?
						if (_trackItem == i)
						{
							// Is a popupMenu showing
							if (_popupMenu != null)
							{
								// Dismiss the submenu
								_popupMenu.Dismiss();

								// No reference needed
								_popupMenu = null;
							}
						}
					}
					else
					{
						// Select the tracked item
						_selected = true;
						_drawUpwards = false;
								
						GrabTheFocus();
				
						// Is there a change in tracking?
						if (_trackItem != i)
						{
							// Modify the display of the two items 
							_trackItem = SwitchTrackingItem(_trackItem, i);
						}
						else
						{
							// Update display to show as selected
							DrawCommand(_trackItem, true);
						}

						// Is there a submenu to show?
						if (dc.Chevron || (dc.MenuCommand.MenuCommands.Count > 0))
							WindowsAPI.PostMessage(this.Handle, WM_OPERATEMENU, 1, 0);
					}

					break;
				}
			}

			base.OnMouseDown(e);
		}

		protected override void OnMouseUp(MouseEventArgs e)
		{
			// Is an item currently being tracked?
			if (_trackItem != -1)
			{
				// Is it also selected?
				if (_selected == true)
				{
					// Is it also showing a submenu
					if (_popupMenu == null)
					{
						// Deselect the item
						_selected = false;
						_drawUpwards = false;

						DrawCommand(_trackItem, true);

						ReturnTheFocus();
					}
				}
			}

			base.OnMouseUp(e);
		}

		protected override void OnMouseMove(MouseEventArgs e)
		{
			// Sometimes we need to ignore this message
			if (_ignoreMouseMove)
				_ignoreMouseMove = false;
			else
			{
				// Is the first time we have noticed a mouse movement over our window
				if (!_mouseOver)
				{
					// Crea the structure needed for WindowsAPI call
					Win32.TRACKMOUSEEVENTS tme = new Win32.TRACKMOUSEEVENTS();

					// Fill in the structure
					tme.cbSize = 16;									
					tme.dwFlags = (uint)Win32.TrackerEventFlags.TME_LEAVE;
					tme.hWnd = this.Handle;								
					tme.dwHoverTime = 0;								

					// Request that a message gets sent when mouse leaves this window
					WindowsAPI.TrackMouseEvent(ref tme);

					// Yes, we know the mouse is over window
					_mouseOver = true;
				}

				Form parentForm = this.FindForm();

				// Only hot track if this Form is active
				if ((parentForm != null) && parentForm.ContainsFocus)
				{
					Point pos = new Point(e.X, e.Y);

					int i = 0;

					for(i=0; i<_drawCommands.Count; i++)
					{
						DrawCommand dc = _drawCommands[i] as DrawCommand;

						// Find the DrawCommand this is over
						if (dc.DrawRect.Contains(pos))
						{
							// Is there a change in selected item?
							if (_trackItem != i)
							{
								// We we currently selecting an item
								if (_selected)
								{
									if (_popupMenu != null)
									{
										// Note that we are dismissing the submenu but not removing
										// the selection of items, this flag is tested by the routine
										// that will return because the submenu has been finished
										_dismissTransfer = true;

										// Dismiss the submenu
										_popupMenu.Dismiss();
		
										// Default to downward drawing
										_drawUpwards = false;
									}

									// Modify the display of the two items 
									_trackItem = SwitchTrackingItem(_trackItem, i);

									// Does the newly selected item have a submenu?
									if (dc.Chevron || (dc.MenuCommand.MenuCommands.Count > 0))	
										WindowsAPI.PostMessage(this.Handle, WM_OPERATEMENU, 1, 0);
								}
								else
								{
									// Modify the display of the two items 
									_trackItem = SwitchTrackingItem(_trackItem, i);
								}
							}

							break;
						}
					}

					// If not in selected mode
					if (!_selected)
					{
						// None of the commands match?
						if (i == _drawCommands.Count)
						{
							// Modify the display of the two items 
							_trackItem = SwitchTrackingItem(_trackItem, -1);
						}
					}
				}
			}

			base.OnMouseMove(e);
		}

		protected override void OnMouseLeave(EventArgs e)
		{
			_mouseOver = false;

			// If we manually grabbed focus then do not switch
			// selection when the mouse leaves the control area
			if (!_manualFocus)
			{
				if (_trackItem != -1)
				{
					// If an item is selected then do not change tracking item when the 
					// mouse leaves the control area, as a popup menu might be showing and 
					// so keep the tracking and selection indication visible
					if (_selected == false)
						_trackItem = SwitchTrackingItem(_trackItem, -1);
				}
			}

			base.OnMouseLeave(e);
		}

		protected override void OnResize(EventArgs e)
		{
			Recalculate();

			// Any resize of control should redraw all of it otherwise when you 
			// stretch to the right it will not paint correctly as we have a one
			// pixel gao between text and min button which is not honoured otherwise
			this.Invalidate();

			base.OnResize(e);
		}

		internal void DrawSelectionUpwards()
		{
			// Double check the state is correct for this method to be called
			if ((_trackItem != -1) && (_selected))
			{
				// This flag is tested in the DrawCommand method
				_drawUpwards = true;

				// Force immediate redraw of the item
				DrawCommand(_trackItem, true);
			}
		}

		protected void Recalculate()
		{
			int length;

			if (_direction == Direction.Horizontal)
				length = this.Width;
			else 

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人黄色av网站在线| 日本道精品一区二区三区| 99re热这里只有精品免费视频| 欧美三级三级三级爽爽爽| 久久久久久久精| 日本不卡视频一二三区| 色av成人天堂桃色av| 国产日韩欧美高清在线| 丝袜美腿高跟呻吟高潮一区| 91视频观看免费| 久久久久久日产精品| 美女视频黄a大片欧美| 色老汉av一区二区三区| 国产精品你懂的在线| 国产在线播放一区| 欧美电影免费观看高清完整版在线| 亚洲日穴在线视频| 成人精品国产福利| 亚洲激情在线激情| 国产成人精品免费看| 日韩欧美激情一区| 日韩不卡一区二区三区| 欧美三级视频在线播放| 亚洲第一主播视频| 欧美日韩精品一区二区三区| 亚洲综合图片区| 欧美中文字幕一二三区视频| 亚洲免费高清视频在线| 成人黄色小视频| 自拍视频在线观看一区二区| 99久久久国产精品免费蜜臀| 亚洲视频在线一区观看| www.日韩大片| 亚洲美女少妇撒尿| 欧美日韩电影一区| 免费视频一区二区| 337p粉嫩大胆噜噜噜噜噜91av| 经典三级视频一区| 久久久影院官网| av动漫一区二区| 亚洲六月丁香色婷婷综合久久| 在线日韩av片| 日韩中文字幕区一区有砖一区 | 日韩你懂的在线播放| 日本欧美肥老太交大片| 精品成人一区二区三区四区| 国产精品影音先锋| 中文字幕制服丝袜一区二区三区| 成人a免费在线看| 亚洲精品国产成人久久av盗摄| 91福利社在线观看| 视频一区欧美日韩| 精品毛片乱码1区2区3区| 国产不卡视频在线观看| 日韩理论片中文av| 欧美性色黄大片| 美女一区二区视频| 中文欧美字幕免费| 欧美日韩国产片| 国产精品原创巨作av| 亚洲男人天堂一区| 精品嫩草影院久久| 成人免费视频一区二区| 三级欧美韩日大片在线看| 久久久亚洲精品一区二区三区 | 欧美成人r级一区二区三区| 国产美女一区二区三区| 精品亚洲porn| 亚洲日本丝袜连裤袜办公室| 欧美一级久久久| www.激情成人| 欧美aaaaaa午夜精品| 国产精品国产三级国产有无不卡 | 久久久久久久综合色一本| 波波电影院一区二区三区| 视频一区视频二区在线观看| 中文字幕国产一区| 欧美一区二区三区思思人| 不卡的av电影| 国产最新精品免费| 五月激情丁香一区二区三区| 国产精品免费看片| 日韩精品一区二区在线观看| 色呦呦一区二区三区| 激情文学综合插| 日韩成人伦理电影在线观看| 综合久久国产九一剧情麻豆| 久久这里只有精品视频网| 欧美视频一区二区三区在线观看| 成人国产精品视频| 韩国女主播成人在线| 天堂蜜桃一区二区三区| 亚洲色图第一区| 国产女人18水真多18精品一级做 | 欧美男男青年gay1069videost| 成人黄色小视频在线观看| 国产美女精品在线| 精品在线免费视频| 麻豆精品久久久| 另类综合日韩欧美亚洲| 午夜亚洲国产au精品一区二区| 成人免费在线观看入口| 国产精品日产欧美久久久久| 久久久久国产精品麻豆| 久久日韩精品一区二区五区| 日韩精品一区二区三区在线播放 | 欧美日韩极品在线观看一区| 91一区在线观看| 99久久免费视频.com| 99麻豆久久久国产精品免费| 成人午夜视频在线观看| 成人在线视频一区| 成人av资源在线观看| av毛片久久久久**hd| 91日韩精品一区| 色老汉一区二区三区| 欧美在线高清视频| 欧美一区二区网站| 日韩午夜在线观看| 精品电影一区二区三区 | 日韩午夜激情电影| 日韩一区二区中文字幕| 日韩一区二区三区四区五区六区| 欧美一区二区三区男人的天堂| 欧美一卡二卡三卡| 欧美xingq一区二区| 久久久久久久久蜜桃| 国产精品久久看| 亚洲成人资源网| 蜜臀91精品一区二区三区| 久久av老司机精品网站导航| 国产高清精品在线| 91丨九色porny丨蝌蚪| 欧美亚洲一区二区在线观看| 欧美精品日韩一区| 久久综合九色综合久久久精品综合 | 国产一区二区久久| av在线综合网| 欧美日本一道本在线视频| 亚洲精品在线观| 亚洲欧美日韩系列| 蜜臀av一区二区在线观看| 懂色一区二区三区免费观看 | 国产精品综合一区二区三区| a4yy欧美一区二区三区| 欧美日韩国产美| 久久久久久久免费视频了| 亚洲精品大片www| 久久丁香综合五月国产三级网站| 99综合电影在线视频| 欧美日韩国产在线观看| 国产婷婷色一区二区三区四区| 亚洲黄色免费电影| 韩国av一区二区三区四区 | 成人性生交大合| 91精品久久久久久久99蜜桃| 国产精品天干天干在观线| 日韩电影在线免费观看| 成人精品国产福利| 日韩久久免费av| 亚洲自拍都市欧美小说| 国产精品亚洲一区二区三区在线 | 久久精品国产秦先生| 色综合天天做天天爱| 日韩欧美国产精品| 一区二区三区四区国产精品| 国产一区二区三区精品欧美日韩一区二区三区 | 亚洲自拍偷拍欧美| 岛国精品在线观看| 日韩一区二区三区四区五区六区| 亚洲欧美日韩国产一区二区三区| 精品一区二区三区视频| 欧美日韩一区二区电影| 自拍偷拍欧美精品| 成人爽a毛片一区二区免费| 精品国产一区二区三区av性色 | 最近日韩中文字幕| 粉嫩绯色av一区二区在线观看| 欧美日韩成人高清| 伊人婷婷欧美激情| 91麻豆.com| 成人免费小视频| 成a人片亚洲日本久久| 久久久久久久久97黄色工厂| 久久激情五月婷婷| 欧美日韩国产a| 亚洲国产精品尤物yw在线观看| 91污片在线观看| 亚洲人成网站影音先锋播放| 99久久精品国产一区| 国产精品国产三级国产aⅴ入口 | 91精品国产综合久久香蕉麻豆| 亚洲尤物在线视频观看| 91免费精品国自产拍在线不卡| 亚洲国产成人私人影院tom| 高清在线观看日韩| 国产欧美日韩在线| 国产成人99久久亚洲综合精品| 精品国产第一区二区三区观看体验| 免费欧美在线视频|