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

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

?? colorpicker.cs

?? chaoshi guan li xitong
?? CS
?? 第 1 頁 / 共 2 頁
字號:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using System.Reflection;
using System.Resources;
using System.Diagnostics;
using UtilityLibrary.General;
using UtilityLibrary.WinControls;
using UtilityLibrary.Win32;

namespace UtilityLibrary.WinControls
{
	
	#region Helper Classes
	public class NewColorArgs : EventArgs
	{
		#region Class Variables
		Color newColor;
		#endregion
		
		#region Class Variables
		public NewColorArgs(Color newColor)
		{
			this.newColor = newColor;
		}
		#endregion

		#region Properties
		public Color NewColor
		{
			get { return newColor;}
		}
		#endregion
	}
		
	[ToolboxItem(false)]
	internal class ArrowButton : System.Windows.Forms.Button
	{

		#region Class Variables
		ColorPicker colorPicker = null;
		DrawState drawState = DrawState.Normal;
		#endregion

		#region Constructor
		public ArrowButton()
		{
		}
						
		public ArrowButton(ColorPicker colorPicker)
		{
			SetStyle(ControlStyles.AllPaintingInWmPaint|ControlStyles.UserPaint|ControlStyles.Opaque, true);
			this.colorPicker = colorPicker;
			TabStop = false;
		}
		#endregion

		#region Overrides
		protected override void OnPaint(PaintEventArgs pe)
		{
			base.OnPaint(pe);
			Graphics g = pe.Graphics;
			DrawArrowState(g, drawState);
		}

		protected override void OnMouseDown(MouseEventArgs e)
		{
			base.OnMouseDown(e);
			if ( colorPicker != null )
				colorPicker.DrawState = DrawState.Pressed;
		}

		protected override void OnGotFocus(EventArgs e)
		{
			base.OnGotFocus(e);
		}

		protected override void OnMouseEnter(EventArgs e)
		{
			base.OnMouseEnter(e);
			if ( colorPicker != null )
				colorPicker.DrawState = DrawState.Hot;
		}

		protected override void OnMouseLeave(EventArgs e)
		{
			
			base.OnMouseLeave(e);
			if ( colorPicker == null ) return;

			Point mousePos = Control.MousePosition;
			if ( !colorPicker.ClientRectangle.Contains(colorPicker.PointToClient(mousePos))	
				&& !colorPicker.colorTextBox.ContainsFocus )
			{
				colorPicker.DrawState = DrawState.Normal;
			}
		}

		protected override  void WndProc(ref Message m)
		{
			Msg currentMessage = (Msg)m.Msg;
						
			switch(m.Msg)
			{
					// The NET MouseEnter Mouse Leave mechanism seems to fall
					// apart when I use PeekMessage function in the ColorPickerDropDown class
					// use the Windows API to keep it working
				case ((int)Msg.WM_MOUSEMOVE):
					if ( colorPicker != null )
					{
						RequestMouseLeaveMessage(m.HWnd); 
						colorPicker.DrawState = DrawState.Hot;
					}
					break;
				case ((int)Msg.WM_MOUSELEAVE):
					Point mousePos = Control.MousePosition;
					if ( colorPicker != null && !colorPicker.ClientRectangle.Contains(colorPicker.PointToClient(mousePos))	
						&& !colorPicker.colorTextBox.ContainsFocus )
					{
						colorPicker.DrawState = DrawState.Normal;
					}
					break;
				default:
					break;
			}

			base.WndProc(ref m);
		}

		#endregion
		
		#region Properties
		internal DrawState DrawState
		{
			set 
			{
				if ( drawState != value )
				{
					drawState = value;
					Invalidate();
				}
			}
			get { return drawState; }
		}

		#endregion

		#region Implementation
		void DrawArrowState(Graphics g, DrawState state)
		{
			if ( colorPicker == null ) return;
			
			if ( state == DrawState.Pressed && colorPicker.colorDropDown.Visible == false )
				state = DrawState.Hot;
			
			DrawBackground(g, state);
			Rectangle rc = ClientRectangle;
			SizeF sizeF = Image.PhysicalDimension;
			int imageWidth = (int)sizeF.Width;
			int imageHeight = (int)sizeF.Height;
			
			// We are assuming that the button image is smaller than
			// the button itself
			if ( imageWidth > rc.Width || imageHeight > rc.Height)
			{
				Debug.WriteLine("Image dimensions need to be smaller that button's dimension...");
				return;
			}

			// Image only drawing
			int	x = (Width - imageWidth)/2;
			int	y = (Height - imageHeight)/2;
			DrawImage(g, state, Image, x, y);
			
		}

		void DrawBackground(Graphics g, DrawState state)
		{
			Rectangle rc = ClientRectangle;
			// Draw background
			if ( state == DrawState.Normal || state == DrawState.Disable )
			{
				g.FillRectangle(new SolidBrush(SystemColors.Control), rc);
				// Draw border rectangle
				g.DrawRectangle(Pens.White, rc.Left, rc.Top, rc.Width-1, rc.Height-1);
			}
			else if ( state == DrawState.Hot || state == DrawState.Pressed  )
			{
				// Erase whatever that was there before
				if ( state == DrawState.Hot )
					g.FillRectangle(new SolidBrush(ColorUtil.VSNetSelectionColor), rc);
				else
					g.FillRectangle(new SolidBrush(ColorUtil.VSNetPressedColor), rc);
				// Draw border rectangle
				g.DrawRectangle(SystemPens.Highlight, rc.Left, rc.Top, rc.Width-1, rc.Height-1);
			}
		}

		void DrawImage(Graphics g, DrawState state, Image image, int x, int y)
		{
			SizeF sizeF = Image.PhysicalDimension;
			int imageWidth = (int)sizeF.Width;
			int imageHeight = (int)sizeF.Height;
			
			if ( state == DrawState.Disable )
				ControlPaint.DrawImageDisabled(g, Image, x, y, SystemColors.Control);
			else
				g.DrawImage(Image, x, y, imageWidth, imageHeight);
		}

		void RequestMouseLeaveMessage(IntPtr hWnd)
		{
			// 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 = hWnd;								
			tme.dwHoverTime = 0;								

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

		#endregion 
		
	}

	internal class ColorPickerEditCtrlHook : System.Windows.Forms.NativeWindow
	{
		#region Class Variables
		ColorPicker colorPicker;
		bool ignoreNextPaintMessage = false;
		#endregion
		
		#region Constructors
		public ColorPickerEditCtrlHook(ColorPicker colorPicker)
		{
			this.colorPicker = colorPicker;
		}
		#endregion 

		#region Overrides
		protected override  void WndProc(ref Message m)
		{
			Msg currentMessage = (Msg)m.Msg;
			switch(m.Msg)
			{
				case ((int)Msg.WM_PAINT):
					if ( ignoreNextPaintMessage )
					{
						ignoreNextPaintMessage = false;
						return;
					}
					
					if ( colorPicker.Enabled == false ) 
					{
						// Let the edit control do its thing first
						base.WndProc(ref m);
						// This is going to generate another paint message
						// ignore it
						ignoreNextPaintMessage = true;
						DrawDisableState();
						return;
					}
					break;
				default:
					break;
			}

			base.WndProc(ref m);
		}
		
		#endregion

		#region Implementation
		void DrawDisableState()
		{
			// we are just going to fill the edit area
			// with a white background, the combobox 
			// already does the hard part
			using (Graphics g = Graphics.FromHwnd(Handle))
			{
				RECT rc = new RECT();
				WindowsAPI.GetClientRect(Handle, ref rc);
				Rectangle clientSize = new Rectangle(rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top);
				g.FillRectangle(Brushes.White, clientSize);

				// Draw text
				STRINGBUFFER buffer;
				WindowsAPI.GetWindowText(Handle, out buffer, 512);
				using ( Brush b = new SolidBrush(SystemColors.ControlDark) )
				{
					string text = buffer.szText;
					Size textSize = TextUtil.GetTextSize(g, text, SystemInformation.MenuFont);
					Point pt = new Point(rc.left, rc.top + ( rc.bottom-textSize.Height )/2);
					g.DrawString(text, colorPicker.Font, b, pt);
				}
			}
		}

		#endregion
	}

	#endregion

	/// <summary>
	/// Summary description for ColorPicker.
	/// </summary>
	[ToolboxItem(false)]
	public class ColorPicker : System.Windows.Forms.UserControl
	{
		
		#region Class Variables
		internal System.Windows.Forms.TextBox colorTextBox;
		internal ArrowButton arrowButton;
		internal ColorPickerDropDown colorDropDown;
		const int COLOR_PANEL_WIDTH = 20;
		const int ARROW_BUTTON_WIDTH = 15;
		int TEXTBOX_HEIGHT = -1;
		const int MARGIN = 8;
		ResourceManager rm = null;
        Color currentColor = Color.White;
		public delegate void NewColorEventHandler(object sender, NewColorArgs e);
		public event NewColorEventHandler NewColor;
		internal DrawState drawState = DrawState.Normal;
		internal DrawState previousState = DrawState.Normal;
		Rectangle displayColorRect;
		ColorPickerEditCtrlHook editHook = null;
				
		/// <summary> 
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		#endregion

		#region Constructors
		public ColorPicker()
		{
			Assembly thisAssembly = Assembly.GetAssembly(Type.GetType("UtilityLibrary.WinControls.ColorPicker"));
			rm = new ResourceManager("UtilityLibrary.Resources.ImagesColorPicker", thisAssembly);

			// This call is required by the Windows.Forms Form Designer.
			InitializeComponent();
		}

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


		#endregion

		#region Overrides
		protected override void OnPaint(PaintEventArgs pe)
		{
			base.OnPaint(pe);
			DrawColorPickerState();
		}

		protected override void OnHandleCreated(EventArgs e)
		{
			base.OnHandleCreated(e);
			// Hook the edit control
			editHook = new ColorPickerEditCtrlHook(this);
			editHook.AssignHandle(colorTextBox.Handle);
		}

		protected override void OnEnabledChanged(EventArgs e)
		{
			if ( Enabled == true )
				drawState = DrawState.Normal;
			else
				drawState = DrawState.Disable;
			base.OnEnabledChanged(e);
		}

		protected override void OnMouseEnter(EventArgs e)
		{
			base.OnMouseEnter(e);
			DrawState = DrawState.Hot;
		}

		protected override void OnMouseLeave(EventArgs e)
		{
			
			base.OnMouseLeave(e);
			Point mousePos = Control.MousePosition;
			if ( !ClientRectangle.Contains(PointToClient(mousePos)) 
				&& !colorTextBox.ContainsFocus )
			{
				DrawState = DrawState.Normal;
				Debug.WriteLine("ON MOUSE LEAVE NORMAL PAINTING...");
			}
		}

		protected override void OnGotFocus(EventArgs e)
		{
			base.OnGotFocus(e);
			DrawState = DrawState.Hot;
		}
        
		protected override void OnLostFocus(EventArgs e)
		{
			base.OnLostFocus(e);
			Point mousePos = Control.MousePosition;
			if ( !ClientRectangle.Contains(PointToClient(mousePos)) ) 
				DrawState = DrawState.Normal;
		}

		protected override void OnResize(EventArgs e)
		{
			base.OnResize(e);
			if ( TEXTBOX_HEIGHT == -1 ) 
			{
				TEXTBOX_HEIGHT = colorTextBox.Height;
			}		
			
			if ( Height != TEXTBOX_HEIGHT + MARGIN )
			{
				Height = TEXTBOX_HEIGHT + MARGIN;
				return;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美午夜寂寞影院| 久久精品人人做| www.在线成人| 日本不卡免费在线视频| 日韩一区在线看| 亚洲精品在线观看网站| 91极品视觉盛宴| 成人黄色一级视频| 精品在线一区二区三区| 亚洲动漫第一页| 亚洲欧美日韩成人高清在线一区| 精品99一区二区三区| 欧美欧美欧美欧美| 日本国产一区二区| 成人国产在线观看| 国产成人亚洲综合a∨婷婷图片| 亚洲国产美女搞黄色| 国产精品电影院| 久久久影视传媒| 日韩欧美在线观看一区二区三区| 色拍拍在线精品视频8848| 国产98色在线|日韩| 免费高清在线一区| 亚洲成人av电影| 亚洲综合色噜噜狠狠| 亚洲色图视频网站| 国产精品无码永久免费888| 精品国产一区二区三区久久久蜜月| 欧美影视一区二区三区| 91福利小视频| 色吧成人激情小说| 色综合av在线| 在线看不卡av| 欧美视频日韩视频| 欧美日韩美少妇| 在线播放欧美女士性生活| 欧美视频精品在线| 欧美日韩aaaaa| 欧美群妇大交群中文字幕| 欧美日韩国产一级片| 欧美日韩国产成人在线91| 欧美日韩国产高清一区二区| 欧美日本在线播放| 欧美一区二区三区在线观看视频| 欧美精品丝袜中出| 91精品国产91久久久久久一区二区| 欧美日韩久久久| 欧美一区二区三区电影| 精品国产自在久精品国产| 精品av综合导航| 国产精品视频第一区| 亚洲天堂精品在线观看| 亚洲一二三专区| 免费观看一级特黄欧美大片| 久久99精品久久久久久| 国产91精品在线观看| av中文一区二区三区| 色av成人天堂桃色av| 欧美卡1卡2卡| 日韩精品一区二区三区中文精品| 久久这里只精品最新地址| 亚洲国产经典视频| 亚洲精品乱码久久久久久日本蜜臀| 亚洲一区二区三区四区五区中文 | 色综合久久久网| 在线中文字幕不卡| 911国产精品| 久久色.com| 亚洲乱码国产乱码精品精的特点| 亚洲国产成人va在线观看天堂| 天天射综合影视| 国产高清视频一区| 在线观看日韩电影| 久久久一区二区| 亚洲激情综合网| 久久99久久久欧美国产| 99精品视频一区二区| 3atv一区二区三区| 亚洲国产成人在线| 天堂久久一区二区三区| 国产jizzjizz一区二区| 欧美午夜片在线看| 国产亚洲成aⅴ人片在线观看| 依依成人精品视频| 美国十次综合导航| 色综合欧美在线| 精品国产乱码久久| 亚洲精品国产第一综合99久久| 捆绑调教一区二区三区| 99久久国产综合精品色伊| 日韩午夜在线影院| 一区二区在线看| 国产精品一二三区| 777精品伊人久久久久大香线蕉| 欧美—级在线免费片| 日韩—二三区免费观看av| 99r国产精品| www亚洲一区| 午夜精品久久久久久久久久 | 高清不卡一区二区在线| 99riav一区二区三区| 精品在线你懂的| 欧洲亚洲精品在线| 国产精品白丝在线| 国产资源在线一区| 91麻豆精品国产91久久久久久| 国产精品视频在线看| 精久久久久久久久久久| 欧美电影一区二区三区| 亚洲免费成人av| 成人中文字幕在线| 精品国产免费视频| 日韩国产欧美视频| 欧美专区在线观看一区| 日韩理论片一区二区| 国产精品自拍一区| 欧美成人精品福利| 亚洲高清免费观看高清完整版在线观看| 国产suv一区二区三区88区| 日韩精品一区国产麻豆| 日韩av一级电影| 欧美日韩国产免费| 一区二区三区在线免费视频| 岛国精品一区二区| 国产亚洲精品福利| 国产一区二区在线看| 欧美不卡视频一区| 免费日韩伦理电影| 日韩欧美一二三| 九一九一国产精品| 精品久久国产字幕高潮| 久99久精品视频免费观看| 日韩一区和二区| 美日韩一区二区三区| 欧美二区三区的天堂| 婷婷成人激情在线网| 欧美日韩国产三级| 日本亚洲欧美天堂免费| 91精品在线麻豆| 另类专区欧美蜜桃臀第一页| 欧美一区二区三区四区视频| 日韩国产在线观看| 欧美一二区视频| 极品少妇一区二区三区精品视频| 欧美大度的电影原声| 极品少妇xxxx偷拍精品少妇| 久久久蜜桃精品| 成人久久久精品乱码一区二区三区 | 91精品国产麻豆| 精品一区二区三区在线观看| 久久精品一二三| 处破女av一区二区| 亚洲免费在线播放| 欧美美女直播网站| 免费xxxx性欧美18vr| 亚洲精品一区二区三区影院| 国产一区激情在线| 国产精品私人自拍| 色老汉av一区二区三区| 香蕉久久一区二区不卡无毒影院| 欧美一级淫片007| 黑人精品欧美一区二区蜜桃 | 国产午夜精品一区二区| 成人h动漫精品| 亚洲一区二区三区影院| 精品剧情在线观看| 成人免费的视频| 亚洲一区中文日韩| 精品免费日韩av| 91麻豆成人久久精品二区三区| 亚洲一二三区不卡| 精品国产乱码久久| 一本久道久久综合中文字幕 | 国产日韩一级二级三级| 91亚洲精品乱码久久久久久蜜桃 | 亚洲精品免费一二三区| 69堂成人精品免费视频| 风流少妇一区二区| 亚洲第一主播视频| 国产欧美一区二区在线观看| 欧美中文字幕久久| 国产麻豆视频精品| 亚洲成人av资源| 亚洲国产精品ⅴa在线观看| 欧美三区在线观看| 国产精品一二三四| 视频一区在线播放| 国产精品狼人久久影院观看方式| 欧美二区乱c少妇| 91丝袜国产在线播放| 麻豆精品一二三| 亚洲综合激情网| 国产女人18水真多18精品一级做| 欧美精品久久天天躁| 成人性视频免费网站| 看片的网站亚洲| 亚洲一区视频在线观看视频| 国产亚洲精品中文字幕| 4438x亚洲最大成人网| 99re这里只有精品6|