logo
VitNX3 Documentation

# VitNX2_Panel.OnPaint Method

Namespace: VitNX2.UI.ControlsV2
Assembly: VitNX3 (in VitNX3.dll)
Raises the Paint event.
VB
C#
F#
C++
JScript
Copy

    protected override void OnPaint(
       PaintEventArgs pevent
    )

    This language is not supported or no code example is available.

#### Parameters

pevent
  PaintEventArgs

Source code
VB
C#
F#
C++
JScript
Copy

    protected override void OnPaint(PaintEventArgs pevent)
     {
         base.OnPaint(pevent);
         Rectangle rectSurface = ClientRectangle;
         Rectangle rectBorder = Rectangle.Inflate(rectSurface, -borderSize, -borderSize);
         int smoothSize = 2;
         if (borderSize > 0)
             smoothSize = borderSize;
         if (borderRadius > 2)
         {
             using (GraphicsPath pathSurface = GetFigurePath(rectSurface, borderRadius))
             using (GraphicsPath pathBorder = GetFigurePath(rectBorder, borderRadius - borderSize))
             using (Pen penSurface = new Pen(Parent.BackColor, smoothSize))
             using (Pen penBorder = new Pen(borderColor, borderSize))
             {
                 pevent.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
                 Region = new Region(pathSurface);
                 pevent.Graphics.DrawPath(penSurface, pathSurface);
                 if (borderSize >= 1)
                     pevent.Graphics.DrawPath(penBorder, pathBorder);
             }
         }
         else
         {
             pevent.Graphics.SmoothingMode = SmoothingMode.None;
             Region = new Region(rectSurface);
             if (borderSize >= 1)
             {
                 using (Pen penBorder = new Pen(borderColor, borderSize))
                 {
                     penBorder.Alignment = PenAlignment.Inset;
                     pevent.Graphics.DrawRectangle(penBorder, 0, 0, Width - 1, Height - 1);
                 }
             }
         }
     }

    This language is not supported or no code example is available.

Applies to

#### .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+
See Also
VitNX2_Panel Class
VitNX2.UI.ControlsV2 Namespace