Version

UltraScrollBar Class

UltraScrollBar control.
Syntax
Remarks

The UltraScrollBar control provides all the functionality of the intrinsic ScrollBar plus several other features. In addition to the benefits of the Presentation Layer Framework (including the ability to owner draw an aspect of the control, one property Infragistics.Win.UltraControlBase.FlatMode settings, alphablending support, and keyboard mappings), the control exposes additional properties to customize the look and feel of the UltraScrollBar. There are 4 Appearance properties for controlling the appearance of the entire scrollbar, scroll thumb, scroll buttons and scroll track. The MinMaxButtonsVisible allows the ability to provide buttons to move to the Minimum and Maximum values. The number and placement of the scroll buttons can be controlled using the ScrollBarArrowStyle.

The UltraScrollBar also provides some additional properties and methods to make the control easier to use. The AutoSize property can be used to have the control maintain the same size as the system scroll bar settings. The AutoDisable property can be used to have the control render disabled when the scroll thumb cannot be moved. The UseDefaultContextMenu can be used to provide a context menu for the scroll bar similar to that of the Windows system ScrollBar.

To make setup of the control easier, the Initialize and GetMaximumDragValue methods, as well as the MaximumDragValue property have been added.

Example
The following sample code illustrates how to set various properties exposes by the UltraScrollBar control.

Imports Infragistics.Win
Imports Infragistics.Win.UltraWinScrollBar

Private Sub InitializeScrollBar()

    With Me.ultraScrollBar1

        ' Note: Under Windows XP if the 'SupportThemes' property
        ' is left set to True (its default setting) then some of
        ' the explicit appearance and button style property
        ' settings are ignored.
        .SupportThemes = False

        ' Set the appearance of the scroll bar control
        ' to use a gradient.
        .Appearance.BackColor = Color.LightGray
        .Appearance.BackColor2 = Color.White
        .Appearance.BackGradientStyle = GradientStyle.HorizontalBump
        .Appearance.ForeColor = Color.Red

        ' Specify the appearance of the scroll buttons
        .ButtonAppearance.BackColor = Color.LightGray
        .ButtonAppearance.BackGradientStyle = GradientStyle.None
        .ButtonAppearance.ForeColor = Color.Red

        ' Specify the appearance of the scroll thumb track area
        .TrackAppearance.BackColor = Color.Gray

        ' Specify the appearance of the scroll thumb
        .ThumbAppearance.BackColor = Color.Silver
        .ThumbAppearance.BackColor = Color.Silver
        .ThumbAppearance.BackGradientStyle = GradientStyle.None
        .ThumbAppearance.BackHatchStyle = BackHatchStyle.Divot

        ' Specify that the scrollbar will be automatically
        ' disabled when the Minimum, Maximum and LargeChange
        ' values don't permit thumb movement.
        .AutoDisable = True

        ' Specify that the control will be sized automatically
        ' based on its 'Orientation'.
        .AutoSize = True

        ' Set the button style for the control
        .ButtonStyle = UIElementButtonStyle.Button3D

        ' Set the 'Minimum', 'Maximum', 'LargeChange' and 
        ' 'SmallChange' properties.
        .Minimum = 45
        .Maximum = 85
        .SmallChange = 1
        .LargeChange = 5

        ' Note: Instead of setting the individual 4 properties 
        ' above you can call the 'Initialize' method and pass
        ' the values in as parameters. 

        .Initialize(45, 80, 1, 5)

        ' Notice, however that the 2nd paramter ('maximumDragValue')
        ' is not the same value we set the 'Maximum' property above.
        '
        ' The 'Initialize' method takes into account the value
        ' of the 'largeChange' parameter and adds that into the
        ' 'Maximum' property. In this example the highest 'Value'
        ' that can be attained is 80 even though 'Maximum' is
        ' set to 85.

        ' Initialize the value property
        .Value = 45
        ' Set the orientation of the control to be vertical.
        .Orientation = Orientation.Vertical

        ' Specify that 2 additional buttons will be
        ' shown, one to go to the minimum value (left/top)
        ' and one to go to the maximum value (right/bottom).
        .MinMaxButtonsVisible = True

        ' Specify where the buttons appear.
        ' Note: This enumeration has a 'None' option to
        ' hide the buttons.
        .ScrollBarArrowStyle = ScrollBarArrowStyle.BothAtLeftTop

        ' If this property is set to true right clicking 
        ' on the scrollbar will display a context menu
        ' with various scrolling options.
        .UseDefaultContextMenu = True

    End With

End Sub
using Infragistics.Win;
using Infragistics.Win.UltraWinScrollBar;

private void InitializeScrollBar()
{

	UltraScrollBar sbar = this.ultraScrollBar1;

	// Note: Under Windows XP if the 'SupportThemes' property
	// is left set to True (its default setting) then some of
	// the explicit appearance and button style property
	// settings are ignored.
	sbar.SupportThemes = false;

	// Set the appearance of the scroll bar control
	// to use a gradient.
	sbar.Appearance.BackColor = Color.LightGray;
	sbar.Appearance.BackColor2 = Color.White;
	sbar.Appearance.BackGradientStyle = GradientStyle.HorizontalBump;
	sbar.Appearance.ForeColor = Color.Red;

	// Specify the appearance of the scroll buttons
	sbar.ButtonAppearance.BackColor = Color.LightGray;
	sbar.ButtonAppearance.BackGradientStyle = GradientStyle.None;
	sbar.ButtonAppearance.ForeColor = Color.Red;
	
	// Specify the appearance of the scroll thumb track area
	sbar.TrackAppearance.BackColor = Color.Gray;
	
	// Specify the appearance of the scroll thumb
	sbar.ThumbAppearance.BackColor = Color.Silver;
	sbar.ThumbAppearance.BackColor = Color.Silver;
	sbar.ThumbAppearance.BackGradientStyle = GradientStyle.None;
	sbar.ThumbAppearance.BackHatchStyle = BackHatchStyle.Divot;

	// Specify that the scrollbar will be automatically
	// disabled when the Minimum, Maximum and LargeChange
	// values don't permit thumb movement.
	sbar.AutoDisable = true;

	// Specify that the control will be sized automatically
	// based on its 'Orientation'.
	sbar.AutoSize = true;
	
	// Set the button style for the control
	sbar.ButtonStyle = UIElementButtonStyle.Button3D;

	// Set the 'Minimum', 'Maximum', 'LargeChange' and 
	// 'SmallChange' properties.
	sbar.Minimum = 45;
	sbar.Maximum = 85;
	sbar.SmallChange = 1;
	sbar.LargeChange = 5;
	
	// Note: Instead of setting the individual 4 properties 
	// above you can call the 'Initialize' method and pass
	// the values in as parameters. 

	sbar.Initialize(45, 80, 1, 5);

	// Notice, however that the 2nd paramter ('maximumDragValue')
	// is not the same value we set the 'Maximum' property above.
	//
	// The 'Initialize' method takes into account the value
	// of the 'largeChange' parameter and adds that into the
	// 'Maximum' property. In this example the highest 'Value'
	// that can be attained is 80 even though 'Maximum' is
	// set to 85.

	// Initialize the value property
	sbar.Value = 45;

	// Set the orientation of the control to be vertical.
	sbar.Orientation = Orientation.Vertical;

	// Specify that 2 additional buttons will be
	// shown, one to go to the minimum value (left/top)
	// and one to go to the maximum value (right/bottom).
	sbar.MinMaxButtonsVisible = true;

	// Specify where the buttons appear.
	// Note: This enumeration has a 'None' option to
	// hide the buttons.
	sbar.ScrollBarArrowStyle = ScrollBarArrowStyle.BothAtLeftTop;

	// If this property is set to true right clicking 
	// on the scrollbar will display a context menu
	// with various scrolling options.
	sbar.UseDefaultContextMenu = true;

}
Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also