⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gbutton.cs

📁 语音视频功能 里面实现了基本的QQ与语音对话
💻 CS
字号:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace gowk.controls
{
	/// <summary>
	/// GButton 的摘要说明。
	/// </summary>
	public class GButton : GAnimateButton
	{
		GImage gimg;
		string _text="";
		public GButton()
		{
			this.gimg=new GImage();
			this.IsRound=true;
		}
		public GImage GImage
		{
			get{return this.gimg;}
			set{this.gimg=value;}
		}
		protected override void OnPaint(PaintEventArgs e)
		{
			base.OnPaint (e);
			State state=State.Normal;
			if(this.ClientRectangle.Contains(this.PointToClient(Control.MousePosition)))
			{
				state=this.Capture?state=State.Pressed:State.Actived;
			}
			Image img=this.GImage.GetImageByState(state);
			if(img!=null)
			e.Graphics.DrawImage(img,this.ClientRectangle);

			if(this._text!=string.Empty)
			{
				StringFormat sf=new StringFormat();
				sf.Trimming=StringTrimming.EllipsisCharacter;
				sf.LineAlignment=StringAlignment.Center;
				sf.Alignment=StringAlignment.Center;
				e.Graphics.DrawString(this.Text,this.Font,new SolidBrush(this.ForeColor),this.ClientRectangle,sf);
				
			}
		}
		protected override void OnPaintBackground(PaintEventArgs pevent)
		{
			base.OnPaintBackground(pevent);
	/*		if((this.BackColor==Color.Transparent || this.BackColor==Color.Empty) && this.Parent!=null)
			{
				this.InvokePaintBackground(this.Parent,pevent);
			}
			else
			{
				pevent.Graphics.FillRectangle(new SolidBrush(this.BackColor),this.ClientRectangle);
			}*/
		//	if(this.BackgroundImage!=null)
			//	pevent.Graphics.DrawImage(this.BackgroundImage,this.ClientRectangle);
		}

		protected override void OnMouseDown(MouseEventArgs e)
		{
			base.OnMouseDown (e);
			this.Invalidate();
		}
		protected override void OnMouseEnter(EventArgs e)
		{
			base.OnMouseEnter (e);
			this.Invalidate();
		}
		protected override void OnMouseLeave(EventArgs e)
		{
			base.OnMouseLeave (e);
			this.Invalidate();
		}
		protected override void OnMouseUp(MouseEventArgs e)
		{
			base.OnMouseUp (e);
			this.Invalidate();
		}
		[System.ComponentModel.Category("gowk")]
		[EditorBrowsable(EditorBrowsableState.Advanced), Browsable(true)]
			[System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Content)]
		public new string Text
		{
			get
			{
				return _text;
			}
			set
			{
				if(value!=this._text)
				{
					this._text=value;
					this.Invalidate();
					this.OnTextChanged(new EventArgs());
				}
			}
		}







	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -