ListBox.HorizontalScrollbar Property

 

Gets or sets a value indicating whether a horizontal scroll bar is displayed in the control.

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

member HorizontalScrollbar : bool with get, set

Property Value

Type: System.Boolean

true to display a horizontal scroll bar in the control; otherwise, false. The default is false.

The HorizontalScrollbar property determines whether the ListBox should display a horizontal scroll bar when the width of items within the ListBox extend beyond the right edge of the control. When this property is set to true, the scroll bar is automatically displayed based on the width of items in the ListBox. If the ListBox is an owner-drawn ListBox, in order to properly display a horizontal scroll bar, you must set the HorizontalExtent property.

The following code example demonstrates how to use the HorizontalScrollbar and HorizontalExtent properties to display a horizontal scroll bar that shows all item text in the ListBox control. The example also uses the IntegralHeight property to ensure that items are not partially displayed due to the size of the ListBox control. This example requires that a ListBox control, named listBox1, has been added to a form.

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

.NET Framework
Available since 1.1
Return to top
Show: