VitNX2_ToogleButton.OnPaint Method
Raises the OnPaint event.
This language is not supported or no code example is available.
Parameters
-
pevent
-
PaintEventArgs
A PaintEventArgs that contains the event data.
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.
.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+