protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { T1 = new Rectangle(1, 1, Width - 3, 18); Bitmap B = new Bitmap(Width, Height); Graphics G = Graphics.FromImage(B); //Drawing G.Clear(C1); LinearGradientBrush G1 = new LinearGradientBrush(new Point(T1.X, T1.Y), new Point(T1.X, T1.Y + T1.Height), C3, C4); G.FillRectangle(G1, T1); G.DrawRectangle(ConversionFunctions.ToPen(C2), T1); G.DrawRectangle(ConversionFunctions.ToPen(C2), new Rectangle(T1.X, T1.Y + T1.Height + 2, T1.Width, Height - T1.Y - T1.Height - 4)); G1.Dispose(); G.DrawString(Text, Font, ConversionFunctions.ToBrush(113, 170, 186), new Rectangle(new Point(T1.X + 4, T1.Y), new Size(T1.Width - 40, T1.Height)), new StringFormat { LineAlignment = StringAlignment.Center }); //Finish Up e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0); G.Dispose(); B.Dispose(); }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { Bitmap B = new Bitmap(Width, Height); Graphics G = Graphics.FromImage(B); LinearGradientBrush G1 = new LinearGradientBrush(new Point(0, 0), new Point(0, Height), C3, C4); G.FillRectangle(G1, ClientRectangle); G1.Dispose(); G.SmoothingMode = SmoothingMode.HighQuality; switch (State) { case MouseState.None: G.DrawEllipse(new Pen(C1, 2), new Rectangle(2, 2, Width - 5, Height - 5)); break; case MouseState.Over: G.DrawEllipse(new Pen(C2, 2), new Rectangle(2, 2, Width - 5, Height - 5)); break; case MouseState.Down: G.DrawEllipse(new Pen(CD, 2), new Rectangle(2, 2, Width - 5, Height - 5)); break; } G.FillEllipse(ConversionFunctions.ToBrush(C2), new Rectangle(5, 5, Width - 11, Height - 11)); e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0); G.Dispose(); B.Dispose(); }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { Bitmap B = new Bitmap(Width, Height); Graphics G = Graphics.FromImage(B); switch (Align) { case Alignment.Horizontal: G.DrawLine(ConversionFunctions.ToPen(C1), new Point(0, Height / 2), new Point(Width, Height / 2)); G.DrawLine(ConversionFunctions.ToPen(C2), new Point(0, Height / 2 + 1), new Point(Width, Height / 2 + 1)); break; case Alignment.Vertical: G.DrawLine(ConversionFunctions.ToPen(C1), new Point(Width / 2, 0), new Point(Width / 2, Height)); G.DrawLine(ConversionFunctions.ToPen(C2), new Point(Width / 2 + 1, 0), new Point(Width / 2 + 1, Height)); break; } e.Graphics.DrawImage(B, 0, 0); G.Dispose(); B.Dispose(); }