'宣言 Public Property TrackAppearanceHorizontal As AppearanceBase
public AppearanceBase TrackAppearanceHorizontal {get; set;}
Imports Infragistics.Win Imports Infragistics.Win.UltraWinScrollBar Private Sub InitializeScrollBarInfo() ' 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. Me.ultraScrollBar1.SupportThemes = False ' The UltraScrollBar control exposes a ScrollBarInfo ' object that exposes many of the same properties as ' the control (the common properties are mapped internally ' by the control so that you can set either the control's ' properties or the ScrollBarInfo's properties). Dim sbInfo As ScrollBarInfo sbInfo = Me.ultraScrollBar1.ScrollBarInfo '--------------------------------------------------- ' Set various properties on the ScrollBarLook object '--------------------------------------------------- ' ScrollBarInfo exposes a 'ScrollBarLook' object that ' exposes properties that effect the look of the ' scroolbar With sbInfo.ScrollBarLook ' Set the default appearance 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.BackGradientStyle = GradientStyle.None .ThumbAppearance.BackHatchStyle = BackHatchStyle.Divot ' 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 '----------------------------------------------------------------------- ' ScrollBarLook also exposes seperate Horizontal and Vertical Appearance, ' ButtonAppearance, TrackAppearance, and ThumbAppearance '----------------------------------------------------------------------- ' Set seperate horizontal and vertical default appearances .AppearanceHorizontal.BackColor = Color.LightGreen .AppearanceHorizontal.BackColor2 = Color.White .AppearanceHorizontal.BackGradientStyle = GradientStyle.ForwardDiagonal .AppearanceHorizontal.ForeColor = Color.Blue .AppearanceVertical.BackColor = Color.LightBlue .AppearanceVertical.BackColor2 = Color.White .AppearanceVertical.BackGradientStyle = GradientStyle.ForwardDiagonal .AppearanceVertical.ForeColor = Color.Green ' Specify seperate horizontal and vertical scroll button appearances .ButtonAppearanceHorizontal.BackColor = Color.LightGreen .ButtonAppearanceHorizontal.BackGradientStyle = GradientStyle.None .ButtonAppearanceHorizontal.ForeColor = Color.DarkGreen .ButtonAppearanceVertical.BackColor = Color.LightBlue .ButtonAppearanceVertical.BackGradientStyle = GradientStyle.None .ButtonAppearanceVertical.ForeColor = Color.DarkBlue ' Specify seperate horizontal and vertical thumb track appearances .TrackAppearanceHorizontal.BackColor = Color.Green .TrackAppearanceVertical.BackColor = Color.Blue ' Specify seperate horizontal and vertical scroll thumb appearances .ThumbAppearanceHorizontal.BackColor = Color.Green .ThumbAppearanceVertical.BackColor = Color.Blue End With '--------------------------------------------------- ' Set various properties on the ScrollBarInfo object '--------------------------------------------------- ' Specify that the scrollbar will be automatically ' disabled when the Minimum, Maximum and LargeChange ' values don't permit thumb movement. sbInfo.AutoDisable = True ' Specify that the # of milliseconds between scroll events ' when the mouse is held down over on scroll button. sbInfo.AutoRepeatDelay = 100 ' Set the button style for the control sbInfo.ButtonStyle = UIElementButtonStyle.Button3D ' Set the 'Minimum', 'Maximum', 'LargeChange' and ' 'SmallChange' properties. sbInfo.Minimum = 45 sbInfo.Maximum = 85 sbInfo.SmallChange = 1 sbInfo.LargeChange = 5 ' Note: Instead of setting the individual 4 properties ' above you can call the 'Initialize' method and pass ' the values in as parameters. sbInfo.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 sbInfo.Value = 45 ' Set the orientation of the control to be vertical. sbInfo.Orientation = Orientation.Vertical ' If this property is set to false then scrolling ' notifications are triggered asynchronously. ' The default setting is false. sbInfo.PriorityScrolling = False ' If this proerty is set to true then the ' thumb will pulse to indicate that the ' control has focus. sbInfo.ShowsFocus = Me.ultraScrollBar1.TabStop End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinScrollBar; private void InitializeScrollBarInfo() { // 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. this.ultraScrollBar1.SupportThemes = false; // The UltraScrollBar control exposes a ScrollBarInfo // object that exposes many of the same properties as // the control (the common properties are mapped internally // by the control so that you can set either the control's // properties or the ScrollBarInfo's properties). ScrollBarInfo sbInfo = this.ultraScrollBar1.ScrollBarInfo; // ScrollBarInfo exposes a 'ScrollBarLook' object that // exposes properties that effect the look of the // scroolbar ScrollBarLook sbLook = sbInfo.ScrollBarLook; //--------------------------------------------------- // Set various properties on the ScrollBarLook object //--------------------------------------------------- // Set the default appearance to use a gradient. sbLook.Appearance.BackColor = Color.LightGray; sbLook.Appearance.BackColor2 = Color.White; sbLook.Appearance.BackGradientStyle = GradientStyle.HorizontalBump; sbLook.Appearance.ForeColor = Color.Red; // Specify the appearance of the scroll buttons sbLook.ButtonAppearance.BackColor = Color.LightGray; sbLook.ButtonAppearance.BackGradientStyle = GradientStyle.None; sbLook.ButtonAppearance.ForeColor = Color.Red; // Specify the appearance of the scroll thumb track area sbLook.TrackAppearance.BackColor = Color.Gray; // Specify the appearance of the scroll thumb sbLook.ThumbAppearance.BackColor = Color.Silver; sbLook.ThumbAppearance.BackGradientStyle = GradientStyle.None; sbLook.ThumbAppearance.BackHatchStyle = BackHatchStyle.Divot; // 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). sbLook.MinMaxButtonsVisible = true; // Specify where the buttons appear. // Note: This enumeration has a 'None' option to // hide the buttons. sbLook.ScrollBarArrowStyle = ScrollBarArrowStyle.BothAtLeftTop; //----------------------------------------------------------------------- // ScrollBarLook also exposes seperate Horizontal and Vertical Appearance, // ButtonAppearance, TrackAppearance, and ThumbAppearance //----------------------------------------------------------------------- // Set seperate horizontal and vertical default appearances sbLook.AppearanceHorizontal.BackColor = Color.LightGreen; sbLook.AppearanceHorizontal.BackColor2 = Color.White; sbLook.AppearanceHorizontal.BackGradientStyle = GradientStyle.ForwardDiagonal; sbLook.AppearanceHorizontal.ForeColor = Color.Blue; sbLook.AppearanceVertical.BackColor = Color.LightBlue; sbLook.AppearanceVertical.BackColor2 = Color.White; sbLook.AppearanceVertical.BackGradientStyle = GradientStyle.ForwardDiagonal; sbLook.AppearanceVertical.ForeColor = Color.Green; // Specify seperate horizontal and vertical scroll button appearances sbLook.ButtonAppearanceHorizontal.BackColor = Color.LightGreen; sbLook.ButtonAppearanceHorizontal.BackGradientStyle = GradientStyle.None; sbLook.ButtonAppearanceHorizontal.ForeColor = Color.DarkGreen; sbLook.ButtonAppearanceVertical.BackColor = Color.LightBlue; sbLook.ButtonAppearanceVertical.BackGradientStyle = GradientStyle.None; sbLook.ButtonAppearanceVertical.ForeColor = Color.DarkBlue; // Specify seperate horizontal and vertical thumb track appearances sbLook.TrackAppearanceHorizontal.BackColor = Color.Green; sbLook.TrackAppearanceVertical.BackColor = Color.Blue; // Specify seperate horizontal and vertical scroll thumb appearances sbLook.ThumbAppearanceHorizontal.BackColor = Color.Green; sbLook.ThumbAppearanceVertical.BackColor = Color.Blue; //--------------------------------------------------- // Set various properties on the ScrollBarInfo object //--------------------------------------------------- // Specify that the scrollbar will be automatically // disabled when the Minimum, Maximum and LargeChange // values don't permit thumb movement. sbInfo.AutoDisable = true; // Specify that the # of milliseconds between scroll events // when the mouse is held down over on scroll button. sbInfo.AutoRepeatDelay = 100; // Set the button style for the control sbInfo.ButtonStyle = UIElementButtonStyle.Button3D; // Set the 'Minimum', 'Maximum', 'LargeChange' and // 'SmallChange' properties. sbInfo.Minimum = 45; sbInfo.Maximum = 85; sbInfo.SmallChange = 1; sbInfo.LargeChange = 5; // Note: Instead of setting the individual 4 properties // above you can call the 'Initialize' method and pass // the values in as parameters. sbInfo.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 sbInfo.Value = 45; // Set the orientation of the control to be vertical. sbInfo.Orientation = Orientation.Vertical; // If this property is set to false then scrolling // notifications are triggered asynchronously. // The default setting is false. sbInfo.PriorityScrolling = false; // If this proerty is set to true then the // thumb will pulse to indicate that the // control has focus. sbInfo.ShowsFocus = this.ultraScrollBar1.TabStop; }