ListBox.ScrollAlwaysVisible Property

 

Gets or sets a value indicating whether the vertical scroll bar is shown at all times.

Namespace:   System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

member ScrollAlwaysVisible : bool with get, set

Property Value

Type: System.Boolean

true if the vertical scroll bar should always be displayed; otherwise, false. The default is false.

The ScrollAlwaysVisible property indicates whether a vertical scroll bar is always displayed, even if the number of items in the ListBox does not require displaying the vertical scroll bar. By default, a ListBox only shows a vertical scroll bar when there are enough items to warrant displaying. For a multicolumn ListBox, the ScrollAlwaysVisible property indicates that a horizontal scroll bar is displayed. A vertical scroll bar is never displayed regardless of the value of this property for a multicolumn ListBox.

The following code example demonstrates an owner-drawn ListBox by setting the DrawMode property to the OwnerDrawVariable value and handling the DrawItem and MeasureItem events. It also demonstrates setting the BorderStyle and ScrollAlwaysVisible properties and using the AddRange method.

To run this example, paste it in an empty form that imports the System.Drawing namespace and the System.Windows.Forms namespace. Call InitializeOwnerDrawnListBox from the form's constructor or Load event-handling method.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: