FormSkin.OnPaint Method

Raises the Paint event.
protected override void OnPaint( 
PaintEventArgs e 
)
This language is not supported or no code example is available.

Parameters

e
PaintEventArgs

A PaintEventArgs that contains the event data.

protected override void OnPaint(PaintEventArgs e)
 {
     Bitmap bitmap = new Bitmap(Width, Height);
     Graphics graphics = Graphics.FromImage(bitmap);
     W = Width;
     H = Height;
     Rectangle rect = new Rectangle(0, 0, W, H);
     Rectangle rect2 = new Rectangle(0, 0, W, 50);
     graphics.SmoothingMode = SmoothingMode.HighQuality;
     graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
     graphics.TextRenderingHint = TextRenderingHint.ClearTypeGridFit;
     graphics.Clear(BackColor);
     graphics.FillRectangle(new SolidBrush(_BaseColor), rect);
     graphics.FillRectangle(new SolidBrush(_HeaderColor), rect2);
     graphics.FillRectangle(new SolidBrush(Color.FromArgb(243, 243, 243)),
         new Rectangle(13, 16, 4, 18));
     graphics.DrawString(Text,
         Font,
         new SolidBrush(TextColor),
         new Rectangle(26, 15, W, H),
         Helpers.NearSF);
     graphics.DrawRectangle(new Pen(_BorderColor), rect);
     OnPaint(e);
     graphics.Dispose();
     e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
     e.Graphics.DrawImageUnscaled(bitmap, 0, 0);
     bitmap.Dispose();
 }
					
This language is not supported or no code example is available.

.NET Framework

Supported in: 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8

.NET Core

Supported in: 5.0+, 6.0+

In this article

Definition