标签:style blog http color io os ar for sp
public class ButtonX:Button { protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { base.OnPaint(e); System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath(); path.AddEllipse(0, 0, this.Width, this.Height); this.Region = new Region(path); } protected override void OnMouseEnter(EventArgs e) { Graphics g = this.CreateGraphics(); g.DrawEllipse(new Pen(Color.Blue), 0, 0, this.Width, this.Height); g.Dispose(); } }
然后生成解决方案,生成之后,工具箱里会有如下图:
这个组件就是新的Button,你直接拖到窗体上就好了,
这个是简单的,效果不满意可以随便画
标签:style blog http color io os ar for sp
原文地址:http://www.cnblogs.com/zhao123/p/4001043.html