using System; using System.ComponentModel; using System.Drawing; using System.Runtime.InteropServices; using System.Windows.Forms; using System.Drawing.Drawing2D; namespace CommonClassLib { public class tButton: Button { protected override void OnPaint(PaintEventArgs e) { int MaxX = this.Size.Width * 2; int MaxY = this.Size.Height * 2; Rectangle recBig = new Rectangle(0, 0, MaxX,MaxY); Rectangle recSmall = new Rectangle(MaxX / 4, MaxY / 4, MaxX / 2, MaxY / 2); Point p1 = new Point(MaxX/2,0); Point p2 = new Point (MaxX/2,MaxY/4); Point p3 = new Point(MaxX/4,MaxY/2); Point p4 = new Point(0, MaxY / 2); base.OnPaint(e); GraphicsPath path1 = new GraphicsPath(); GraphicsPath path2 = new GraphicsPath(); path1.AddArc( recBig, 180, 90); path1.AddLine(0, 0, MaxX/2, 0); path1.AddLine(0, 0, 0, MaxY / 2); Region rg1 = new Region(path1); e.Graphics.FillRegion(new SolidBrush(Color.White), rg1); path2.AddArc(recSmall, 180, 90); path2.AddLine(MaxX/4,MaxY/2, MaxX /2,MaxY/2); path2.AddLine(MaxX /2,MaxY/2,MaxX/2, MaxY/4); Region rg2 = new Region(path2); e.Graphics.FillRegion(new SolidBrush(Color.White), rg2); e.Graphics.DrawArc(new Pen(new SolidBrush(Color.Black)), recBig, 180, 90); e.Graphics.DrawLine(new Pen(new SolidBrush(Color.Black)), p1, p2); e.Graphics.DrawArc(new Pen(new SolidBrush(Color.Black)), recSmall, 180, 90); e.Graphics.DrawLine(new Pen(new SolidBrush(Color.Black)), p3, p4); e.Dispose(); } } }