亚洲欧美第一页_禁久久精品乱码_粉嫩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 AquaButton : 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
        private Button button1;


		#region Constructors and Initializers

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

		private void InitializeComponent( )
		{
            this.button1 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(0, 0);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 0;
            this.button1.Text = "button1";
            this.button1.UseVisualStyleBackColor = true;
            this.ResumeLayout(false);

		}

		#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( AquaButton.ButtonDefaultWidth, 
					 AquaButton.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 = AquaButton.PulseInterval;
				timer.Tick += new EventHandler( TimerOnTick );
				gamma = AquaButton.PulseGammaMax;
				gammaShift = -AquaButton.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 - AquaButton.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 - AquaButton.PulseGammaMin < AquaButton.PulseGammaReductionThreshold ) || 
				(AquaButton.PulseGammaMax - gamma < AquaButton.PulseGammaReductionThreshold ))
				gamma += gammaShift * AquaButton.PulseGammaShiftReduction;
			else
				gamma += gammaShift;

			if ( gamma <= AquaButton.PulseGammaMin || gamma >= AquaButton.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一区二区三区免费野_久草精品视频
国产色综合久久| 色婷婷精品大视频在线蜜桃视频| 日韩欧美一级精品久久| 欧美日韩一区 二区 三区 久久精品| 一区二区三区在线免费观看| 国产欧美日韩不卡免费| 日韩一区二区三区视频| 色婷婷激情一区二区三区| 成人一区二区视频| 国产美女一区二区三区| 国产综合久久久久久久久久久久| 日韩高清电影一区| 天天射综合影视| 三级久久三级久久| 三级影片在线观看欧美日韩一区二区| 亚洲女同ⅹxx女同tv| 亚洲天堂成人在线观看| 国产丝袜在线精品| 国产精品久线在线观看| 欧美日韩国产一级片| 欧美丝袜第三区| 91精品国产麻豆国产自产在线| 一本一本久久a久久精品综合麻豆 一本一道波多野结衣一区二区 | 亚洲精品大片www| 国产精品国产三级国产有无不卡| 国产精品久久久久久久久久久免费看| 久久久久久久久久久电影| 国产调教视频一区| 中文字幕中文字幕在线一区| 亚洲老司机在线| 亚洲成人av电影在线| 亚洲成人av中文| 免费在线视频一区| 国产不卡一区视频| 激情丁香综合五月| 成人精品视频一区| 在线免费观看一区| 日韩小视频在线观看专区| 精品少妇一区二区三区日产乱码| 久久久精品黄色| 亚洲蜜臀av乱码久久精品蜜桃| 亚洲一区二区高清| 激情文学综合插| 99re这里只有精品视频首页| 欧美电影在哪看比较好| 精品国产伦一区二区三区观看体验| 国产日韩欧美一区二区三区乱码 | 在线观看区一区二| 欧美日韩一区二区三区免费看| 欧美日韩国产影片| 久久综合给合久久狠狠狠97色69| 国产精品视频在线看| 午夜精品久久久久| 国产传媒欧美日韩成人| 欧美性视频一区二区三区| 久久久精品免费网站| 亚洲成人中文在线| 成人av手机在线观看| 日韩一区二区三| 亚洲欧美激情插| 激情综合色播激情啊| 欧美日韩在线播放| 国产欧美视频在线观看| 日韩精品一二三区| 91在线无精精品入口| 精品国产91乱码一区二区三区| 一区二区免费视频| 99这里都是精品| 久久先锋影音av| 午夜欧美在线一二页| 不卡大黄网站免费看| 精品欧美一区二区久久| 日韩电影免费在线看| 在线欧美日韩国产| 《视频一区视频二区| 国产美女久久久久| 欧美日韩国产综合草草| 亚洲综合在线五月| 色综合天天做天天爱| 中文字幕欧美区| 国产大陆a不卡| 国产性色一区二区| 精品一区二区三区av| 日韩一区二区三区视频| 日韩精品成人一区二区三区| 欧美在线观看视频一区二区 | 一区二区三区不卡视频| 91首页免费视频| 中文字幕在线播放不卡一区| 国产精品一区二区久久精品爱涩 | 午夜精品一区二区三区电影天堂 | 99re在线视频这里只有精品| 91精品国产综合久久福利软件 | 久久在线免费观看| 九九热在线视频观看这里只有精品| 制服丝袜一区二区三区| 日本不卡一区二区三区| 日韩欧美亚洲国产另类| 国内精品伊人久久久久影院对白| 久久一夜天堂av一区二区三区| 久久精品噜噜噜成人88aⅴ| 日韩欧美在线综合网| 久久黄色级2电影| 日韩精品一区二区三区蜜臀 | eeuss影院一区二区三区| 国产精品欧美一区喷水| 91在线看国产| 日本欧美大码aⅴ在线播放| 91精品黄色片免费大全| 国模冰冰炮一区二区| 国产精品不卡在线| 欧美三级在线看| 美腿丝袜亚洲色图| 欧美国产精品一区二区| 99国内精品久久| 亚洲一区二区视频在线| 日韩一区二区三区免费看| 蜜桃精品视频在线| 欧美激情一二三区| av一二三不卡影片| 中文一区在线播放| 91麻豆福利精品推荐| 日韩高清不卡一区二区| 国产欧美日本一区视频| 欧美无人高清视频在线观看| 久久精品99国产精品| 国产精品久久久久久久久图文区| 日本高清无吗v一区| 激情五月播播久久久精品| 中文字幕色av一区二区三区| 91精品久久久久久久99蜜桃| 成人av电影在线播放| 偷拍一区二区三区四区| 中文字幕av一区二区三区| 欧美日韩视频一区二区| 蜜臀久久久久久久| 国产精品久久久久久久第一福利| 成人国产精品免费观看视频| 无吗不卡中文字幕| 中文字幕一区在线观看视频| 欧美成人a∨高清免费观看| 91黄视频在线观看| 成人免费毛片a| 男人的天堂久久精品| 亚洲另类在线一区| 国产精品无人区| 精品国产伦一区二区三区观看方式| 91丨九色丨蝌蚪丨老版| 国产成人av一区二区| 蜜桃一区二区三区在线| 中文一区二区完整视频在线观看| 欧美无人高清视频在线观看| va亚洲va日韩不卡在线观看| 国内精品视频一区二区三区八戒| 亚洲18色成人| 亚洲精品伦理在线| 中文字幕一区二区三| 久久精品欧美一区二区三区麻豆| 欧美岛国在线观看| 91精品国产综合久久精品app | 国产99久久久精品| 国产综合久久久久久鬼色| 日韩主播视频在线| 一个色妞综合视频在线观看| 自拍偷拍亚洲综合| 国产精品久久久久久久久免费桃花| 久久这里都是精品| 精品久久久久香蕉网| 欧美日韩久久一区二区| 色综合久久综合网欧美综合网| 99精品久久免费看蜜臀剧情介绍| 成人综合在线视频| 成人午夜激情影院| 91一区一区三区| 欧美日韩国产三级| 久久久久久久网| 一区二区三区蜜桃| 日本美女一区二区| 成人午夜视频免费看| 欧美日韩一区二区三区四区| 精品国产91久久久久久久妲己| 欧美激情中文字幕一区二区| 一区二区三区日韩| 国内欧美视频一区二区| 色婷婷精品久久二区二区蜜臀av| 7777精品伊人久久久大香线蕉完整版 | 91精品国产91久久久久久一区二区 | 国产美女娇喘av呻吟久久| 99麻豆久久久国产精品免费| 欧美年轻男男videosbes| 久久久久久久久久久久久女国产乱| 亚洲色图制服丝袜| 久久99国产精品久久99果冻传媒| 9l国产精品久久久久麻豆| 欧美久久久久免费| 国产精品久久久一本精品 | 成人av网址在线观看| 日韩亚洲电影在线| 亚洲三级久久久| 国内精品视频666|