protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { Bitmap B = new Bitmap(Width, Height); Graphics G = Graphics.FromImage(B); base.OnPaint(e); G.Clear(BackColor); Font drawFont = new Font("Merlett", 8, FontStyle.Bold); switch (State) { case MouseState.None: LinearGradientBrush lgb = new LinearGradientBrush(MinBtn, Color.FromArgb(50, 50, 50), Color.FromArgb(45, 45, 45), 90); G.FillPath(lgb, Draw.RoundRect(MinBtn, (int)2.5)); G.DrawPath(Pens.Black, Draw.RoundRect(MinBtn, (int)2.5)); G.DrawString("_", drawFont, new SolidBrush(Color.Silver), MinBtn, new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); LinearGradientBrush lgb2 = new LinearGradientBrush(CloseBtn, Color.FromArgb(50, 50, 50), Color.FromArgb(45, 45, 45), 90); G.FillPath(lgb2, Draw.RoundRect(CloseBtn, (int)2.5)); G.DrawPath(Pens.Black, Draw.RoundRect(CloseBtn, (int)2.5)); G.DrawString("x", drawFont, new SolidBrush(Color.Silver), CloseBtn, new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); break; case MouseState.Over: if (X > MinBtn.X & X < MinBtn.X + 35) { LinearGradientBrush lgb1 = new LinearGradientBrush(MinBtn, Color.FromArgb(50, 85, 255, 85), Color.FromArgb(45, 45, 45), 90); G.FillPath(lgb1, Draw.RoundRect(MinBtn, (int)2.5)); G.DrawPath(Pens.Black, Draw.RoundRect(MinBtn, (int)2.5)); G.DrawString("_", drawFont, new SolidBrush(Color.Silver), MinBtn, new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); LinearGradientBrush lgb21 = new LinearGradientBrush(CloseBtn, Color.FromArgb(50, 50, 50), Color.FromArgb(45, 45, 45), 90); G.FillPath(lgb21, Draw.RoundRect(CloseBtn, (int)2.5)); G.DrawPath(Pens.Black, Draw.RoundRect(CloseBtn, (int)2.5)); G.DrawString("x", drawFont, new SolidBrush(Color.Silver), CloseBtn, new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); } else { LinearGradientBrush lgb211 = new LinearGradientBrush(CloseBtn, Color.FromArgb(50, 30, 30), Color.FromArgb(45, 45, 45), 90); G.FillPath(lgb211, Draw.RoundRect(CloseBtn, (int)2.5)); G.DrawPath(Pens.Black, Draw.RoundRect(CloseBtn, (int)2.5)); G.DrawString("x", drawFont, new SolidBrush(Color.Silver), CloseBtn, new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); LinearGradientBrush lgb11 = new LinearGradientBrush(MinBtn, Color.FromArgb(50, 50, 50), Color.FromArgb(45, 45, 45), 90); G.FillPath(lgb11, Draw.RoundRect(MinBtn, (int)2.5)); G.DrawPath(Pens.Black, Draw.RoundRect(MinBtn, (int)2.5)); G.DrawString("_", drawFont, new SolidBrush(Color.Silver), MinBtn, new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }); } break; } e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0); G.Dispose(); B.Dispose(); }