ScrollBarRenderingConfigurator
The look of a scroll bar – colours, gradients, images, gripper – and how fast it repeats while an arrow
is held. Every ScrollBarBase has one, in its
ScrollBarBase.ScrollBarRenderingConfigurator property.
public sealed class ScrollBarRenderingConfigurator
Remarks
Start from a theme
Setting ColorTheme fills in the colours of a built-in theme, overwriting the ones it
covers; set it first and adjust individual colours afterwards. A new configurator starts with
ColorTheme.GradientBrown.
Gradients win over solid colours
The track, the thumb and the arrow buttons are each drawn as a gradient when both colours of their
gradient pair are set, and in a solid colour (TrackFillColor, ThumbFillColor,
NavigationButtonsColor) when either is Color.Empty. Every built-in theme
sets the gradient pairs, so to use the solid colours, set a gradient colour to
Color.Empty.
Images
An image set for a part and state (an arrow, the thumb, the gripper) replaces the drawn version of that part in that state; a state without an image falls back to the colours.
Arrow and gripper images are drawn at their own pixel size, not scaled with the display; thumb images are stretched over the thumb.
Examples
var look = statementBar.ScrollBarRenderingConfigurator;
look.ColorTheme = ColorTheme.Custom; // the theme first
look.GradientStartThumbFillColor = Color.Empty; // solid fills from here on
look.ThumbFillColor = Color.FromArgb(0, 120, 215);
look.ControlVisualStateHoverColor = Color.FromArgb(0, 99, 177);
look.ControlVisualStatePressedColor = Color.FromArgb(0, 69, 120);
look.TrackFillColor = Color.FromArgb(240, 240, 240);
look.GradientStartTrackFillColor = Color.Empty;
look.ShouldDrawGripperArtefact = false;
statementBar.Invalidate();See also
Members at a glance
| Constructors | |
|---|---|
ScrollBarRenderingConfigurator | Initialises a configurator with the ColorTheme.GradientBrown theme, arrows on, and an
auto-repeat interval of 100 milliseconds. |
| Properties | |
AutoScrollInterval | Gets or sets how often the position steps while an arrow button or the track is held down. |
BorderColor | Gets or sets the colour of the line around the bar, the arrow buttons and the thumb. |
BuiltInNavigationButtonImageDimension | Gets or sets the size of the drawn arrow on the arrow buttons. |
ColorTheme | Gets or sets the built-in theme, and fills in its colours. |
ControlOnHoverBorderHighlightColor | Gets or sets the outline of an arrow button or thumb while the pointer is over it. |
ControlVisualStateHoverColor | Gets or sets the fill of an arrow button or thumb while the pointer is over it. |
ControlVisualStatePressedColor | Gets or sets the fill of an arrow button while it is pressed, and of the thumb while it is dragged. |
GradientEndNavigationButtonBackgroundColor | Gets or sets the right-hand colour of the gradient that fills an idle arrow button. |
GradientEndThumbFillColor | Gets or sets the second colour of the thumb's gradient, which runs across the bar. |
GradientEndTrackFillColor | Gets or sets the second colour of the track's gradient, which runs across the bar. |
GradientStartNavigationButtonBackgroundColor | Gets or sets the left-hand colour of the gradient that fills an idle arrow button. |
GradientStartThumbFillColor | Gets or sets the first colour of the thumb's gradient, which runs across the bar. |
GradientStartTrackFillColor | Gets or sets the first colour of the track's gradient, which runs across the bar. |
GripperColor1 | Gets or sets the colour of the first, third, fifth and seventh of the eight grip ridges on the thumb. |
GripperColor2 | Gets or sets the colour of the second, fourth, sixth and eighth of the eight grip ridges on the thumb. |
HorizontalGripperImage | Gets or sets an image drawn at the centre of a horizontal bar's thumb in place of the grip ridges. |
HorizontalScrollButtonImageLeftHot | Gets or sets the image drawn on the left arrow button of a horizontal bar while the pointer is over it. |
HorizontalScrollButtonImageLeftNormal | Gets or sets the image drawn on the left arrow button of a horizontal bar while it is idle. |
HorizontalScrollButtonImageLeftPressed | Gets or sets the image drawn on the left arrow button of a horizontal bar while it is pressed. |
HorizontalScrollButtonImageRightHot | Gets or sets the image drawn on the right arrow button of a horizontal bar while the pointer is over it. |
HorizontalScrollButtonImageRightNormal | Gets or sets the image drawn on the right arrow button of a horizontal bar while it is idle. |
HorizontalScrollButtonImageRightPressed | Gets or sets the image drawn on the right arrow button of a horizontal bar while it is pressed. |
HorizontalThumbBoxImageHot | Gets or sets the image a horizontal bar's thumb is drawn with while the pointer is over it. |
HorizontalThumbBoxImageNormal | Gets or sets the image a horizontal bar's thumb is drawn with while it is idle. |
HorizontalThumbBoxImagePressed | Gets or sets the image a horizontal bar's thumb is drawn with while it is being dragged. |
IsDrawingNavigationButtonArrowsEnabled | Gets or sets whether arrows, drawn or from images, appear on the arrow buttons. |
NavigationButtonArrowColor | Gets or sets the colour of the arrows drawn on the arrow buttons. |
NavigationButtonsColor | Gets or sets the solid fill of an idle arrow button, used when either button gradient colour is
Color.Empty. |
ShouldDrawBorderOnThumbWhenDrawingThumbAsCustomImage | Gets or sets whether the thumb's border is drawn around a thumb image. |
ShouldDrawCustomNavigationButtonArrowImageUnscaled | Gets or sets whether an arrow button image larger than its button is drawn at its own size instead of being stretched to the button. |
ShouldDrawGripperArtefact | Gets or sets whether grip ridges, or VerticalGripperImage / HorizontalGripperImage,
are drawn across the middle of the thumb. |
ThumbFillColor | Gets or sets the solid colour of an idle thumb, used when either thumb gradient colour is
Color.Empty. |
ThumbGripperMajorColor | Gets or sets a gripper colour that the themes set but the built-in drawing does not use. |
ThumbGripperMinorColor | Gets or sets a gripper colour that the themes set but the built-in drawing does not use. |
TrackFillColor | Gets or sets the solid colour of the track, used when either track gradient colour is
Color.Empty. |
VerticalGripperImage | Gets or sets an image drawn at the centre of a vertical bar's thumb in place of the grip ridges. |
VerticalScrollButtonImageDownHot | Gets or sets the image drawn on the down arrow button of a vertical bar while the pointer is over it. |
VerticalScrollButtonImageDownNormal | Gets or sets the image drawn on the down arrow button of a vertical bar while it is idle. |
VerticalScrollButtonImageDownPressed | Gets or sets the image drawn on the down arrow button of a vertical bar while it is pressed. |
VerticalScrollButtonImageUpHot | Gets or sets the image drawn on the up arrow button of a vertical bar while the pointer is over it. |
VerticalScrollButtonImageUpNormal | Gets or sets the image drawn on the up arrow button of a vertical bar while it is idle. |
VerticalScrollButtonImageUpPressed | Gets or sets the image drawn on the up arrow button of a vertical bar while it is pressed. |
VerticalThumbBoxImageHot | Gets or sets the image a vertical bar's thumb is drawn with while the pointer is over it. |
VerticalThumbBoxImageNormal | Gets or sets the image a vertical bar's thumb is drawn with while it is idle. |
VerticalThumbBoxImagePressed | Gets or sets the image a vertical bar's thumb is drawn with while it is being dragged. |
Constructors
ScrollBarRenderingConfigurator
Initialises a configurator with the ColorTheme.GradientBrown theme, arrows on, and an
auto-repeat interval of 100 milliseconds.
Properties
AutoScrollInterval
Gets or sets how often the position steps while an arrow button or the track is held down.
- Value
- In milliseconds. The default is 100.
- Default
100
Remarks
The first repeat comes after two intervals, so a quick click is a single step.
BorderColor
Gets or sets the colour of the line around the bar, the arrow buttons and the thumb.
- Value
- Set by
ColorTheme: white forColorTheme.GradientBrown.
Remarks
A part under the pointer is outlined in ControlOnHoverBorderHighlightColor instead; a
disabled bar is outlined in the system's light control colour.
ColorTheme
Gets or sets the built-in theme, and fills in its colours.
- Value
- The default is
ColorTheme.GradientBrown.
Remarks
Setting it overwrites the gradient, border, arrow, hover, pressed and gripper colours and
ShouldDrawGripperArtefact, and turns the arrows back on, so set it before adjusting any of
them. It does not touch the images,
ThumbFillColor, NavigationButtonsColor or AutoScrollInterval, and only
ColorTheme.Custom sets TrackFillColor.
ColorTheme.Custom sets a plain black-on-white starting point and leaves
BorderColor and the hover and pressed colours as they were.
Example
foreach (var bar in new ScrollBarBase[] { reportPanel.VerticalScrollBar, reportPanel.HorizontalScrollBar })
{
bar.ScrollBarRenderingConfigurator.ColorTheme = ColorTheme.OfficeBlack;
bar.Invalidate();
}ControlOnHoverBorderHighlightColor
Gets or sets the outline of an arrow button or thumb while the pointer is over it.
- Value
- Set by
ColorTheme.Color.Emptyuses the system highlight colour.
Remarks
The thumb is also outlined in this colour, when idle or dragged, if BorderColor is
Color.Empty.
ControlVisualStateHoverColor
Gets or sets the fill of an arrow button or thumb while the pointer is over it.
- Value
- Set by
ColorTheme: orange-brown forColorTheme.GradientBrown.
Remarks
A gradient thumb keeps its gradient and starts it from this colour.
See also
ControlVisualStatePressedColor
Gets or sets the fill of an arrow button while it is pressed, and of the thumb while it is dragged.
- Value
- Set by
ColorTheme.
Remarks
A gradient thumb keeps its gradient and starts it from this colour.
See also
GradientEndThumbFillColor
Gets or sets the second colour of the thumb's gradient, which runs across the bar.
- Value
- Set by
ColorTheme.Color.Emptyfills the thumb withThumbFillColorinstead.
See also
GradientEndTrackFillColor
Gets or sets the second colour of the track's gradient, which runs across the bar.
- Value
- Set by
ColorTheme.Color.Emptyfills the track withTrackFillColorinstead.
See also
GradientStartThumbFillColor
Gets or sets the first colour of the thumb's gradient, which runs across the bar.
- Value
- Set by
ColorTheme.Color.Emptyfills the thumb withThumbFillColorinstead.
Remarks
Under the pointer or while dragged, the gradient starts from ControlVisualStateHoverColor
or ControlVisualStatePressedColor instead.
See also
GradientStartTrackFillColor
Gets or sets the first colour of the track's gradient, which runs across the bar.
- Value
- Set by
ColorTheme.Color.Emptyfills the track withTrackFillColorinstead.
See also
GripperColor1
Gets or sets the colour of the first, third, fifth and seventh of the eight grip ridges on the thumb.
- Value
- Set by
ColorTheme: dark red forColorTheme.GradientBrown.
See also
GripperColor2
Gets or sets the colour of the second, fourth, sixth and eighth of the eight grip ridges on the thumb.
- Value
- Set by
ColorTheme: white for most themes.
See also
HorizontalGripperImage
Gets or sets an image drawn at the centre of a horizontal bar's thumb in place of the grip ridges.
- Value
null(the default) for the drawn ridges.
Remarks
Drawn only while ShouldDrawGripperArtefact is true.
HorizontalScrollButtonImageLeftHot
Gets or sets the image drawn on the left arrow button of a horizontal bar while the pointer is over it.
- Value
null(the default) to draw the arrow inNavigationButtonArrowColor.
Remarks
Drawn only while IsDrawingNavigationButtonArrowsEnabled is true, over the
button's background. See ShouldDrawCustomNavigationButtonArrowImageUnscaled for an image larger
than the button.
HorizontalScrollButtonImageLeftNormal
Gets or sets the image drawn on the left arrow button of a horizontal bar while it is idle.
- Value
null(the default) to draw the arrow inNavigationButtonArrowColor.
Remarks
Drawn only while IsDrawingNavigationButtonArrowsEnabled is true, over the
button's background. See ShouldDrawCustomNavigationButtonArrowImageUnscaled for an image larger
than the button.
HorizontalScrollButtonImageLeftPressed
Gets or sets the image drawn on the left arrow button of a horizontal bar while it is pressed.
- Value
null(the default) to draw the arrow inNavigationButtonArrowColor.
Remarks
Drawn only while IsDrawingNavigationButtonArrowsEnabled is true, over the
button's background. See ShouldDrawCustomNavigationButtonArrowImageUnscaled for an image larger
than the button.
HorizontalScrollButtonImageRightHot
Gets or sets the image drawn on the right arrow button of a horizontal bar while the pointer is over it.
- Value
null(the default) to draw the arrow inNavigationButtonArrowColor.
Remarks
Drawn only while IsDrawingNavigationButtonArrowsEnabled is true, over the
button's background. See ShouldDrawCustomNavigationButtonArrowImageUnscaled for an image larger
than the button.
HorizontalScrollButtonImageRightNormal
Gets or sets the image drawn on the right arrow button of a horizontal bar while it is idle.
- Value
null(the default) to draw the arrow inNavigationButtonArrowColor.
Remarks
Drawn only while IsDrawingNavigationButtonArrowsEnabled is true, over the
button's background. See ShouldDrawCustomNavigationButtonArrowImageUnscaled for an image larger
than the button.
HorizontalScrollButtonImageRightPressed
Gets or sets the image drawn on the right arrow button of a horizontal bar while it is pressed.
- Value
null(the default) to draw the arrow inNavigationButtonArrowColor.
Remarks
Drawn only while IsDrawingNavigationButtonArrowsEnabled is true, over the
button's background. See ShouldDrawCustomNavigationButtonArrowImageUnscaled for an image larger
than the button.
HorizontalThumbBoxImageHot
Gets or sets the image a horizontal bar's thumb is drawn with while the pointer is over it.
- Value
null(the default) to draw the thumb in colour in that state.
Remarks
Stretched over the whole thumb. While a thumb image is in use the gripper is not drawn, and the
border only when ShouldDrawBorderOnThumbWhenDrawingThumbAsCustomImage is
true.
HorizontalThumbBoxImageNormal
Gets or sets the image a horizontal bar's thumb is drawn with while it is idle.
- Value
null(the default) to draw the thumb in colour in that state.
Remarks
Stretched over the whole thumb. While a thumb image is in use the gripper is not drawn, and the
border only when ShouldDrawBorderOnThumbWhenDrawingThumbAsCustomImage is
true.
HorizontalThumbBoxImagePressed
Gets or sets the image a horizontal bar's thumb is drawn with while it is being dragged.
- Value
null(the default) to draw the thumb in colour in that state.
Remarks
Stretched over the whole thumb. While a thumb image is in use the gripper is not drawn, and the
border only when ShouldDrawBorderOnThumbWhenDrawingThumbAsCustomImage is
true.
ShouldDrawBorderOnThumbWhenDrawingThumbAsCustomImage
Gets or sets whether the thumb's border is drawn around a thumb image.
- Value
trueto outline the image inBorderColor; the default isfalse.- Default
false
See also
ShouldDrawGripperArtefact
Gets or sets whether grip ridges, or VerticalGripperImage / HorizontalGripperImage,
are drawn across the middle of the thumb.
- Value
- Set by
ColorTheme:truefor every theme exceptColorTheme.Win8.
Remarks
The gripper is left out on a thumb shorter than 12 logical pixels and on a thumb drawn from an image.
ThumbFillColor
Gets or sets the solid colour of an idle thumb, used when either thumb gradient colour is
Color.Empty.
- Value
- No theme sets it; a new configurator starts with
Color.Empty.
See also
ThumbGripperMajorColor
Gets or sets a gripper colour that the themes set but the built-in drawing does not use.
- Value
- Set by
ColorTheme.
Remarks
The grip ridges are drawn in GripperColor1 and GripperColor2.
ThumbGripperMinorColor
Gets or sets a gripper colour that the themes set but the built-in drawing does not use.
- Value
- Set by
ColorTheme.
Remarks
The grip ridges are drawn in GripperColor1 and GripperColor2.
TrackFillColor
Gets or sets the solid colour of the track, used when either track gradient colour is
Color.Empty.
- Value
- White for
ColorTheme.Custom; the other themes leave it as it was, and a new configurator starts withColor.Empty.
See also
VerticalGripperImage
Gets or sets an image drawn at the centre of a vertical bar's thumb in place of the grip ridges.
- Value
null(the default) for the drawn ridges.
Remarks
Drawn only while ShouldDrawGripperArtefact is true.
VerticalScrollButtonImageDownHot
Gets or sets the image drawn on the down arrow button of a vertical bar while the pointer is over it.
- Value
null(the default) to draw the arrow inNavigationButtonArrowColor.
Remarks
Drawn only while IsDrawingNavigationButtonArrowsEnabled is true, over the
button's background. See ShouldDrawCustomNavigationButtonArrowImageUnscaled for an image larger
than the button.
VerticalScrollButtonImageDownNormal
Gets or sets the image drawn on the down arrow button of a vertical bar while it is idle.
- Value
null(the default) to draw the arrow inNavigationButtonArrowColor.
Remarks
Drawn only while IsDrawingNavigationButtonArrowsEnabled is true, over the
button's background. See ShouldDrawCustomNavigationButtonArrowImageUnscaled for an image larger
than the button.
VerticalScrollButtonImageDownPressed
Gets or sets the image drawn on the down arrow button of a vertical bar while it is pressed.
- Value
null(the default) to draw the arrow inNavigationButtonArrowColor.
Remarks
Drawn only while IsDrawingNavigationButtonArrowsEnabled is true, over the
button's background. See ShouldDrawCustomNavigationButtonArrowImageUnscaled for an image larger
than the button.
VerticalScrollButtonImageUpHot
Gets or sets the image drawn on the up arrow button of a vertical bar while the pointer is over it.
- Value
null(the default) to draw the arrow inNavigationButtonArrowColor.
Remarks
Drawn only while IsDrawingNavigationButtonArrowsEnabled is true, over the
button's background. See ShouldDrawCustomNavigationButtonArrowImageUnscaled for an image larger
than the button.
VerticalScrollButtonImageUpNormal
Gets or sets the image drawn on the up arrow button of a vertical bar while it is idle.
- Value
null(the default) to draw the arrow inNavigationButtonArrowColor.
Remarks
Drawn only while IsDrawingNavigationButtonArrowsEnabled is true, over the
button's background. See ShouldDrawCustomNavigationButtonArrowImageUnscaled for an image larger
than the button.
VerticalScrollButtonImageUpPressed
Gets or sets the image drawn on the up arrow button of a vertical bar while it is pressed.
- Value
null(the default) to draw the arrow inNavigationButtonArrowColor.
Remarks
Drawn only while IsDrawingNavigationButtonArrowsEnabled is true, over the
button's background. See ShouldDrawCustomNavigationButtonArrowImageUnscaled for an image larger
than the button.
VerticalThumbBoxImageHot
Gets or sets the image a vertical bar's thumb is drawn with while the pointer is over it.
- Value
null(the default) to draw the thumb in colour in that state.
Remarks
Stretched over the whole thumb. While a thumb image is in use the gripper is not drawn, and the
border only when ShouldDrawBorderOnThumbWhenDrawingThumbAsCustomImage is
true.
VerticalThumbBoxImageNormal
Gets or sets the image a vertical bar's thumb is drawn with while it is idle.
- Value
null(the default) to draw the thumb in colour in that state.
Remarks
Stretched over the whole thumb. While a thumb image is in use the gripper is not drawn, and the
border only when ShouldDrawBorderOnThumbWhenDrawingThumbAsCustomImage is
true.
VerticalThumbBoxImagePressed
Gets or sets the image a vertical bar's thumb is drawn with while it is being dragged.
- Value
null(the default) to draw the thumb in colour in that state.
Remarks
Stretched over the whole thumb. While a thumb image is in use the gripper is not drawn, and the
border only when ShouldDrawBorderOnThumbWhenDrawingThumbAsCustomImage is
true.