protected override void OnPaint(PaintEventArgs pe) { pe.Graphics.InterpolationMode = InterpolationMode.Bilinear; pe.Graphics.PixelOffsetMode = PixelOffsetMode.Half; Rectangle r = ClientRectangle; int halfWidth = r.Width / 2; int halfHeight = r.Height / 2; int LeftX = 10; int RightX = r.Width - 30; int topY = 10; int BottomY = r.Height - 25; var linearGradientBrush = new LinearGradientBrush(r, TopColor, BottomColor, LinearGradientMode.Vertical); pe.Graphics.FillRectangle(linearGradientBrush, r); var font = new Font(this.Font, FontStyle.Bold); using (Brush br = new SolidBrush(AllColor.GrayScale(true).Inverse())) pe.Graphics.DrawString("ALL", font, br, new Point(halfWidth - 12, halfHeight - 10)); using (Brush br = new SolidBrush(TopColor.GrayScale(true).Inverse())) pe.Graphics.DrawString("T", font, br, new Point(halfWidth - 7, topY)); using (Brush br = new SolidBrush(BottomColor.GrayScale(true).Inverse())) pe.Graphics.DrawString("B", font, br, new Point(halfWidth - 7, BottomY)); // pe.Graphics.FillRectangle(linearGradientBrush, ClientRectangle); const int hitSize = 40; TopHit = new Rectangle(halfWidth - 10, topY, hitSize, hitSize); BottomHit = new Rectangle(halfWidth - 10, BottomY, hitSize, hitSize); AllHit = new Rectangle(halfWidth - 10, halfHeight - 10, hitSize, hitSize); base.OnPaint(pe); }