'宣言 Public Property Appearance As AppearanceBase
public AppearanceBase Appearance {get; set;}
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; }