0 out of 2 rated this helpful - Rate this topic

ListBox.CustomTabOffsets Property

Gets the width of the tabs between the items in the ListBox.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
[BrowsableAttribute(false)]
public ListBox..::..IntegerCollection CustomTabOffsets { get; }

Property Value

Type: System.Windows.Forms.ListBox.IntegerCollection
A collection of integers representing the tab widths.

The integer array contains the tab spaces in ascending order.

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
What the values mean.
The integers in the array are measured from the edge of the ListBox and are in units of one quarter of the average character width of the font in the ListBox. So, to get an offset at 5 character widths from the edge followed by another one 10 characters after that, the code should look something like this.

listbox.CustomTabOffsets.Add(5 * 4);
listbox.CustomTabOffsets.Add((5 + 10) * 4);

The array is kept automatically sorted from smallest to largest, and duplicates are automatically removed. Thus the following code...

listbox.CustomTabOffsets.Add(100);
listbox.CustomTabOffsets.Add(50);
listbox.CustomTabOffsets.Add(50);

... will result in the array containing just two entries, 50 followed by 100.