logo
VitNX3 Documentation

# VitNX_ScrollBar.OnPaint Method

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

    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.

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

    protected override void OnPaint(PaintEventArgs e)
     {
         var g = e.Graphics;
         var upIcon = _upArrowHot ? ScrollIcons.scrollbar_arrow_hot : ScrollIcons.scrollbar_arrow_standard;

         if (_upArrowClicked)
             upIcon = ScrollIcons.scrollbar_arrow_clicked;

         if (!Enabled)
             upIcon = ScrollIcons.scrollbar_arrow_disabled;

         if (_scrollOrientation == VitNX_ScrollOrientation.Vertical)
             upIcon.RotateFlip(RotateFlipType.RotateNoneFlipY);
         else if (_scrollOrientation == VitNX_ScrollOrientation.Horizontal)
             upIcon.RotateFlip(RotateFlipType.Rotate90FlipNone);

         g.DrawImageUnscaled(upIcon,
                             _upArrowArea.Left + (_upArrowArea.Width / 2) - (upIcon.Width / 2),
                             _upArrowArea.Top + (_upArrowArea.Height / 2) - (upIcon.Height / 2));

         var downIcon = _downArrowHot ? ScrollIcons.scrollbar_arrow_hot : ScrollIcons.scrollbar_arrow_standard;

         if (_downArrowClicked)
             downIcon = ScrollIcons.scrollbar_arrow_clicked;

         if (!Enabled)
             downIcon = ScrollIcons.scrollbar_arrow_disabled;

         if (_scrollOrientation == VitNX_ScrollOrientation.Horizontal)
             downIcon.RotateFlip(RotateFlipType.Rotate270FlipNone);

         g.DrawImageUnscaled(downIcon,
                             _downArrowArea.Left + (_downArrowArea.Width / 2) - (downIcon.Width / 2),
                             _downArrowArea.Top + (_downArrowArea.Height / 2) - (downIcon.Height / 2));
         if (Enabled)
         {
             var scrollColor = _thumbHot ? Colors.GreyHighlight : Colors.GreySelection;

             if (_isScrolling)
                 scrollColor = Colors.ActiveControl;

             using (var b = new SolidBrush(scrollColor))
                 g.FillRectangle(b, _thumbArea);
         }
     }

    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
VitNX_ScrollBar Class
VitNX.UI.ControlsV1.Controls Namespace