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

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

?? button.cs

?? 按鈕的個性化
?? CS
字號:

///	
///	Button.cs
///
///		 by Dave Peckham
///		 August 2002
///		 Irvine, California
///	
///	A button that emulates the Apple Aqua user interface guidelines.
///	This button grows horizontally to accomodate its label. Button
///	height is fixed.
///	

using System;
using System.Reflection;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;


namespace Wildgrape.Aqua.Controls
{
	[Description( "Aqua Button Control" )]
	[Designer(typeof (Wildgrape.Aqua.Controls.ButtonDesigner))]
	public class Button : System.Windows.Forms.Button 
	{
		#region Class Constants

		protected static int ButtonDefaultWidth = 80;

		// Set this to the height of your source bitmaps
		protected static int ButtonHeight = 30;

		// If your source bitmaps have shadows, set this 
		// to the shadow size so DrawText can position the 
		// label appears centered on the label
		protected static int ButtonShadowOffset = 5;

		// These settings approximate the pulse effect
		// of buttons on Mac OS X
		protected static int PulseInterval = 70;
		protected static float PulseGammaMax = 1.8f;
		protected static float PulseGammaMin = 0.7f;
		protected static float PulseGammaShift = 0.2f;
		protected static float PulseGammaReductionThreshold = 0.2f;
		protected static float PulseGammaShiftReduction = 0.5f;

		#endregion


		#region Member Variables

		// Appearance
		protected bool	pulse = false;
		protected bool	sizeToLabel = true;

		// Pulsing
		protected Timer timer;
		protected float gamma, gammaShift;

		// Mouse tracking
		protected Point ptMousePosition;
		protected bool	mousePressed;

		// Images used to draw the button
		protected Image imgLeft, imgFill, imgRight;

		// Rectangles to position images on the button face
		protected Rectangle rcLeft, rcRight;

		// Matrices for transparency transformation
		protected ImageAttributes iaDefault, iaNormal;
		protected ColorMatrix cmDefault, cmNormal;

		#endregion


		#region Constructors and Initializers

		public Button( ) 
		{
			InitializeComponent(  );
			SetStyle( ControlStyles.StandardClick, true );
		}

		private void InitializeComponent( )
		{
		}

		#endregion


		#region Properties

		[Description( "Determines whether the button pulses. Note that only the default button can pulse." )]
		[Category( "Appearance" )]
		[DefaultValue( false )]
		public bool Pulse
		{
			get { return pulse; }
			set { pulse = value; }
		}

		[Description( "Determines whether the button should automatically size to fit the label" )]
		[Category( "Layout" )]
		[DefaultValue( true )]
		public bool SizeToLabel
		{
			get { return sizeToLabel; }
			set 
			{ 
				sizeToLabel = value;
				OnTextChanged( EventArgs.Empty ); 
			}
		}

		#endregion


		#region Property overrides

		/* AquaButton has a fixed height */
		protected override Size DefaultSize
		{
			get	{return new Size( Button.ButtonDefaultWidth, 
					 Button.ButtonHeight ); }
		}

		/* Shadow Control.Width to make it browsable */
		[Description( "See also: SizeToLabel" )]
		[Category( "Layout" )]
		[Browsable( true )]
		public new int Width 
		{
			get { return base.Width; }
			set { base.Width = value; }
		}

		/* Shadow Control.Height to make it browsable and read only */
		[Description( "Aqua buttons have a fixed height" )]
		[Category( "Layout" )]
		[Browsable( true )]
		[ReadOnly( true )]
		public new int Height {	get { return base.Height; }	}

		#endregion


		#region Method overrides

		protected override void OnCreateControl()
		{
			LoadImages();
			InitializeGraphics();
		}

		protected override void OnTextChanged( EventArgs e )
		{
			if (sizeToLabel) 
			{
				Graphics g = this.CreateGraphics( );
				SizeF sizeF = g.MeasureString( Text, Font );
				Width = imgLeft.Width + (int)sizeF.Width + imgRight.Width;
				g.Dispose();
			}
			Invalidate( );
			Update( );
			base.OnTextChanged( e );
		}

		protected override void OnPaint( PaintEventArgs e )
		{
			Graphics g = e.Graphics;
			g.Clear(Parent.BackColor);
			Draw( g );
		}

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

			if (Pulse)
				StartPulsing();
		}
		
		protected override void OnLostFocus( EventArgs e )
		{
			base.OnLostFocus( e );

			if (Pulse)
				StopPulsing();
		}
		
		protected override void OnMouseDown( MouseEventArgs e )
		{
			base.OnMouseDown( e );

			if( e.Button == MouseButtons.Left ) 
			{
				mousePressed = true;

				ptMousePosition.X = e.X;
				ptMousePosition.Y = e.Y;

				StopPulsing( );
			}
		}

		protected override void OnMouseMove( MouseEventArgs e )
		{
			// Buttons receives MouseMove events when the
			// mouse enters or leaves the client area.

			base.OnMouseMove( e );

			if( mousePressed && ( e.Button & MouseButtons.Left ) != 0 )
			{
				ptMousePosition.X = e.X;
				ptMousePosition.Y = e.Y;
			} 
		}

		protected override void OnMouseUp( MouseEventArgs e )
		{
			base.OnMouseUp( e );

			if( mousePressed ) 
			{
				mousePressed = false;

				StartPulsing( );

				Invalidate();
				Update( );
			}
		}

		protected override void OnKeyPress( KeyPressEventArgs e )
		{
			base.OnKeyPress( e );

			if( mousePressed && e.KeyChar == '\x001B' )  // Escape
			{
				mousePressed = false;

				StartPulsing( );

				Invalidate();
				Update( );
			}
		}

		#endregion


		#region Implementation

		protected virtual void LoadImages ()
		{
			imgLeft = new Bitmap( GetType(), "Button.left.png" );
			imgRight = new Bitmap( GetType(), "Button.right.png" );
			imgFill = new Bitmap( GetType(), "Button.fill.png" );
		}

		protected virtual void InitializeGraphics ()
		{
			// Rectangles for placing images relative to the client rectangle
			rcLeft = new Rectangle( 0, 0, imgLeft.Width, imgLeft.Height );
			rcRight = new Rectangle( 0, 0, imgRight.Width, imgRight.Height );

			// Image attributes used to lighten default buttons

			cmDefault = new ColorMatrix();
			cmDefault.Matrix33 = 0.5f;  // reduce opacity by 50%

			iaDefault = new ImageAttributes();
			iaDefault.SetColorMatrix( cmDefault, ColorMatrixFlag.Default, 
				ColorAdjustType.Bitmap );
			
			// Image attributes that lighten and desaturate normal buttons
	
			cmNormal = new ColorMatrix();

			// desaturate the image
			cmNormal.Matrix00 = 1/3f;
			cmNormal.Matrix01 = 1/3f;
			cmNormal.Matrix02 = 1/3f;
			cmNormal.Matrix10 = 1/3f;
			cmNormal.Matrix11 = 1/3f;
			cmNormal.Matrix12 = 1/3f;
			cmNormal.Matrix20 = 1/3f;
			cmNormal.Matrix21 = 1/3f;
			cmNormal.Matrix22 = 1/3f;
			cmNormal.Matrix33 = 0.5f;  // reduce opacity by 50%

			iaNormal = new ImageAttributes();
			iaNormal.SetColorMatrix( cmNormal, ColorMatrixFlag.Default, 
				ColorAdjustType.Bitmap );
		}

		protected virtual void StartPulsing ()
		{
			if ( Focused && Pulse && !this.DesignModeDetected( ) )
			{
				timer = new Timer( );
				timer.Interval = Button.PulseInterval;
				timer.Tick += new EventHandler( TimerOnTick );
				gamma = Button.PulseGammaMax;
				gammaShift = -Button.PulseGammaShift;
				timer.Start();
			}
		}

		protected virtual void StopPulsing ()
		{
			if ( timer != null )
			{
				iaDefault.SetGamma( 1.0f, ColorAdjustType.Bitmap );
				timer.Stop();
			}
		}

		protected virtual void Draw( Graphics g )
		{
			DrawButton( g );
			DrawText( g );
		}

		protected virtual void DrawButton( Graphics g )
		{
			// Update our destination rectangles
			rcRight.X = this.Width - imgRight.Width;

			if ( mousePressed )
			{
				if ( ClientRectangle.Contains( ptMousePosition.X, ptMousePosition.Y ) )
					DrawButtonState( g, iaDefault );
				else
					DrawButtonState( g, iaNormal );
			}
			else if ( IsDefault )
				DrawButtonState( g, iaDefault );
			else
				DrawButtonState( g, iaNormal );
		}

		protected virtual void DrawButtonState (Graphics g, ImageAttributes ia)
		{
			TextureBrush tb;

			// Draw the left and right endcaps
			g.DrawImage( imgLeft, rcLeft, 0, 0, 
				imgLeft.Width, imgLeft.Height, GraphicsUnit.Pixel, ia );

			g.DrawImage( imgRight, rcRight, 0, 0, 
				imgRight.Width, imgRight.Height, GraphicsUnit.Pixel, ia );

			// Draw the middle
			tb = new TextureBrush( imgFill, 
				new Rectangle( 0, 0, imgFill.Width, imgFill.Height ), ia );
			tb.WrapMode = WrapMode.Tile;

			g.FillRectangle ( tb, imgLeft.Width, 0, 
				this.Width - (imgLeft.Width + imgRight.Width), 
				imgFill.Height);

			tb.Dispose( );
		}

		protected virtual void DrawText( Graphics g ) 
		{
			RectangleF layoutRect = 
				new RectangleF( 0, 0, this.Width, 
					this.Height - Button.ButtonShadowOffset );

			int LabelShadowOffset = 1;

			StringFormat fmt	= new StringFormat( );
			fmt.Alignment		= StringAlignment.Center;
			fmt.LineAlignment	= StringAlignment.Center;

			// Draw the shadow below the label
			layoutRect.Offset( 0, LabelShadowOffset );
			SolidBrush textShadowBrush	= new SolidBrush( Color.Gray );
			g.DrawString( Text, Font, textShadowBrush, layoutRect, fmt );
			textShadowBrush.Dispose( );

			// and the label itself
			layoutRect.Offset( 0, -LabelShadowOffset );
			SolidBrush brushFiller	= new SolidBrush( Color.Black );
			g.DrawString( Text, Font, brushFiller, layoutRect, fmt );
			brushFiller.Dispose( );
		}

		protected virtual void TimerOnTick( object obj, EventArgs e)
		{
			// set the new gamma level
			if ((gamma - Button.PulseGammaMin < Button.PulseGammaReductionThreshold ) || 
				(Button.PulseGammaMax - gamma < Button.PulseGammaReductionThreshold ))
				gamma += gammaShift * Button.PulseGammaShiftReduction;
			else
				gamma += gammaShift;

			if ( gamma <= Button.PulseGammaMin || gamma >= Button.PulseGammaMax )
				gammaShift = -gammaShift;

			iaDefault.SetGamma( gamma, ColorAdjustType.Bitmap );

			Invalidate( );
			Update( );
		}

		protected virtual bool DesignModeDetected()
		{
			// base.DesignMode always returns false, so try this workaround
			IDesignerHost host = 
				(IDesignerHost) this.GetService( typeof( IDesignerHost ) );

			return ( host != null );
		}

		#endregion
	}
}


?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
卡一卡二国产精品| 精品一区二区免费视频| **欧美大码日韩| 亚洲成人综合网站| 日本不卡视频一二三区| 国产精品一级在线| 国产亚洲成年网址在线观看| 亚洲一区在线观看视频| 色综合久久中文综合久久牛| 国产一区二区美女| 国产成人福利片| av在线这里只有精品| 高清国产一区二区| 高清日韩电视剧大全免费| 91黄色免费网站| 国产欧美综合在线观看第十页| 亚洲欧美在线视频| 国内不卡的二区三区中文字幕| 日本丶国产丶欧美色综合| 精品久久久久久综合日本欧美| 欧美激情一区二区| 日韩电影一二三区| 在线观看三级视频欧美| 日本中文字幕一区二区视频| 国产一区二区三区免费播放| 久久免费看少妇高潮| 懂色av一区二区三区蜜臀| 中文字幕国产一区| 国产成人午夜视频| 久久综合999| 国产乱人伦精品一区二区在线观看| 欧美美女一区二区在线观看| 亚洲亚洲精品在线观看| 色哟哟在线观看一区二区三区| 中文字幕欧美激情| 91亚洲精品久久久蜜桃| 亚洲六月丁香色婷婷综合久久| 成人av网站大全| 亚洲激情五月婷婷| 欧美精品日韩精品| 久久爱www久久做| 国产欧美日韩在线观看| 色美美综合视频| 男女性色大片免费观看一区二区| 精品成人在线观看| 91精品1区2区| 激情综合网最新| 国产精品麻豆网站| 欧美日高清视频| 国产精品18久久久久久久久久久久| 国产精品美女久久久久aⅴ国产馆| 欧美性大战久久| 国产91丝袜在线播放九色| 亚洲一卡二卡三卡四卡| 欧美电影免费观看高清完整版| 国产aⅴ综合色| 午夜精品一区二区三区三上悠亚| 久久久国际精品| 欧美亚洲动漫精品| 成人免费视频国产在线观看| 亚洲成av人片观看| 一区二区三区色| 国产日韩欧美电影| 91精品国产福利| 成人免费毛片aaaaa**| 视频一区二区中文字幕| 亚洲欧洲成人自拍| 精品精品国产高清a毛片牛牛| 成人三级在线视频| 国模大尺度一区二区三区| 亚洲一区二区在线免费观看视频 | 精品国产伦一区二区三区观看方式| 国模无码大尺度一区二区三区| 欧美日韩在线一区二区| 亚洲免费看黄网站| 91亚洲永久精品| 在线日韩一区二区| 欧美一级电影网站| 欧美伦理影视网| 欧美视频一区在线| 在线观看一区不卡| 成人精品电影在线观看| 蜜桃精品视频在线| 青青草视频一区| 久久精品国产免费| 国产麻豆精品久久一二三| 麻豆精品久久精品色综合| 午夜成人在线视频| 奇米影视一区二区三区小说| 青草av.久久免费一区| 日韩经典一区二区| 天天操天天色综合| 亚洲国产精品久久人人爱| 亚洲精品videosex极品| 国产欧美一区视频| 1000精品久久久久久久久| 国产精品久久久久一区二区三区 | 亚州成人在线电影| 热久久免费视频| 波多野结衣中文字幕一区| 丁香五精品蜜臀久久久久99网站 | 欧美视频在线观看一区二区| av亚洲产国偷v产偷v自拍| 欧美亚洲一区二区三区四区| 欧美日韩精品一区二区三区| 欧美成人女星排名| 亚洲免费成人av| 午夜免费久久看| 国产精品亚洲视频| 欧美日韩国产另类一区| 中文字幕第一区二区| 亚洲午夜在线电影| 日本亚洲电影天堂| 色欧美乱欧美15图片| 久久视频一区二区| 久久99精品网久久| 欧美丰满高潮xxxx喷水动漫| 亚洲欧洲色图综合| 精品一二三四在线| 欧美视频你懂的| 自拍视频在线观看一区二区| 狠狠色丁香久久婷婷综合丁香| 成人精品鲁一区一区二区| 日韩视频免费观看高清完整版 | 91美女精品福利| 中文一区二区在线观看| 日韩精品三区四区| 欧美一区二区大片| 日韩电影在线一区二区三区| 欧美日韩在线精品一区二区三区激情| 国产精品高潮久久久久无| 成人免费视频一区| 国产精品福利av| 成人h动漫精品一区二| 亚洲免费观看高清完整版在线观看 | 国产精品午夜电影| 国产99精品视频| 中文字幕人成不卡一区| 91一区二区三区在线观看| 日韩精品欧美精品| 欧美日韩不卡一区二区| 国产一区二区不卡| 国产精品天天摸av网| 国产99一区视频免费| 亚洲欧美另类久久久精品| 91精品国产高清一区二区三区| 亚洲午夜av在线| 欧美人xxxx| 激情久久五月天| 欧美精品一区二区久久久| 国产精品综合av一区二区国产馆| 欧美私人免费视频| 日本成人在线网站| 日本一区二区三区dvd视频在线| 成人看片黄a免费看在线| 洋洋av久久久久久久一区| 日韩一区二区在线观看视频播放| 久久99精品国产.久久久久| 久久影院电视剧免费观看| 99免费精品在线| 午夜电影网亚洲视频| 久久影视一区二区| aaa欧美色吧激情视频| 免费国产亚洲视频| 一级精品视频在线观看宜春院 | 国产原创一区二区| 亚洲影院在线观看| 中文字幕不卡在线| 欧美亚洲丝袜传媒另类| 成人久久久精品乱码一区二区三区| 亚洲影院免费观看| 国产精品国产精品国产专区不蜜| 欧美一区二区三区思思人| 91伊人久久大香线蕉| 粉嫩av一区二区三区粉嫩| 国产一区二区三区在线看麻豆| 五月综合激情网| 亚洲高清免费观看高清完整版在线观看 | 毛片基地黄久久久久久天堂| 亚洲一区成人在线| 中文字幕日本不卡| 国产精品久久久久久久第一福利| 国产精品你懂的| 国产精品乱人伦| 中文字幕不卡在线| 国产精品日韩精品欧美在线| 国产亚洲精品7777| 国产精品人妖ts系列视频| 日韩欧美你懂的| 欧美一区二区性放荡片| 日韩视频永久免费| 久久亚洲私人国产精品va媚药| 国产日韩欧美在线一区| ...av二区三区久久精品| 偷拍与自拍一区| 免费看日韩精品| 成人免费高清在线| 欧美美女bb生活片| 欧美激情在线看| 视频一区二区三区中文字幕|