ListBox.UseTabStops 属性

获取或设置一个值,该值指示 ListBox 在绘制其字符串时是否可识别和展开制表符。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
Public Property UseTabStops As Boolean
用法
Dim instance As ListBox
Dim value As Boolean

value = instance.UseTabStops

instance.UseTabStops = value
public bool UseTabStops { get; set; }
public:
property bool UseTabStops {
    bool get ();
    void set (bool value);
}
/** @property */
public boolean get_UseTabStops ()

/** @property */
public void set_UseTabStops (boolean value)
public function get UseTabStops () : boolean

public function set UseTabStops (value : boolean)

属性值

如果控件可展开制表符,则为 true;否则为 false。默认为 true

示例

下面的代码示例演示如何创建一个 ListBox,用以显示带有制表符的项。

Private Sub CreateTabStopList()
    Dim listBox1 As New ListBox()
    listBox1.SetBounds(20, 20, 100, 100)

    Dim x As Integer
    For x = 1 To 19
        listBox1.Items.Add(("Item" + ControlChars.Tab + x.ToString()))
    Next x
    ' Make the ListBox display tabs within each item.
    listBox1.UseTabStops = True
    Me.Controls.Add(listBox1)
End Sub
private void CreateTabStopList()
{
    ListBox listBox1 = new ListBox();
    listBox1.SetBounds(20,20,100,100);

    for(int x = 1; x < 20;x++)
    {
        listBox1.Items.Add("Item\t" + x.ToString());
    }
    // Make the ListBox display tabs within each item.
    listBox1.UseTabStops = true;
    this.Controls.Add(listBox1);
}
private:
   void CreateTabStopList()
   {
      ListBox^ listBox1 = gcnew ListBox;
      listBox1->SetBounds( 20, 20, 100, 100 );
      for ( int x = 1; x < 20; x++ )
      {
         listBox1->Items->Add( String::Concat( "Item\t", x ) );
      }
      listBox1->UseTabStops = true;
      this->Controls->Add( listBox1 );
   }
private void CreateTabStopList()
{
    ListBox listBox1 = new ListBox();
    listBox1.SetBounds(20, 20, 100, 100);

    for (int x = 1; x < 20; x++) {
        listBox1.get_Items().Add("Item\t" + Convert.ToString(x));
    }
    // Make the ListBox display tabs within each item.
    listBox1.set_UseTabStops(true);
    this.get_Controls().Add(listBox1);
} //CreateTabStopList

.NET Framework 安全性

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

ListBox 类
ListBox 成员
System.Windows.Forms 命名空间