protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { using (Bitmap B = new Bitmap(Width, Height)) { using (var G = Graphics.FromImage(B)) { G.Clear(C3); Draw.Gradient(G, C4, C3, 0, 0, Width, _TitleHeight); G.DrawString(Text, Font, new SolidBrush(ForeColor), 6, 6); G.DrawLine(new Pen(C3), 0, 1, Width, 1); Draw.Blend(G, C5, C6, C5, 0.5F, 0, 0, _TitleHeight + 1, Width, 1); G.DrawLine(new Pen(C4), 0, _TitleHeight, Width, _TitleHeight); G.DrawRectangle(new Pen(C4), 0, 0, Width - 1, Height - 1); e.Graphics.DrawImage((Image)B.Clone(), (float)0, (float)0); } } }
protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { using (Bitmap B = new Bitmap(Width, Height)) { using (var G = Graphics.FromImage(B)) { G.DrawRectangle(new Pen(C1), 0, 0, Width - 1, Height - 1); if (State == 2) { Draw.Gradient(G, C2, C3, 1, 1, Width - 2, Height - 2); } else { Draw.Gradient(G, C3, C2, 1, 1, Width - 2, Height - 2); } var O = G.MeasureString(Text, Font); G.DrawString(Text, Font, new SolidBrush(ForeColor), Width / 2 - O.Width / 2, Height / 2 - O.Height / 2 + 1); Draw.Blend(G, C4, C5, C4, 0.5F, 0, 1, 1, Width - 2, 1); e.Graphics.DrawImage((Image)B.Clone(), (float)0, (float)0); } } }