logo
VitNX3 Documentation

# VitNX2_ToogleButton.OnPaint Method

Namespace: VitNX2.UI.ControlsV2
Assembly: VitNX3 (in VitNX3.dll)
Raises the OnPaint 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

A PaintEventArgs that contains the event data.

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

    protected override void OnPaint(PaintEventArgs pevent)
     {
         int toggleSize = Height - 5;
         pevent.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
         pevent.Graphics.Clear(Parent.BackColor);
         if (Checked)
         {
             if (solidStyle)
                 pevent.Graphics.FillPath(new SolidBrush(onBackColor), GetFigurePath());
             else
                 pevent.Graphics.DrawPath(new Pen(onBackColor, 2), GetFigurePath());
             pevent.Graphics.FillEllipse(new SolidBrush(onToggleColor),
                 new Rectangle(Width - Height + 1, 2, toggleSize,
                 toggleSize));
         }
         else
         {
             if (solidStyle)
                 pevent.Graphics.FillPath(new SolidBrush(offBackColor), GetFigurePath());
             else
                 pevent.Graphics.DrawPath(new Pen(offBackColor, 2), GetFigurePath());
             pevent.Graphics.FillEllipse(new SolidBrush(offToggleColor),
                 new Rectangle(2, 2,
                 toggleSize,
                 toggleSize));
         }
     }

    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_ToogleButton Class
VitNX2.UI.ControlsV2 Namespace