ListBox.UseTabStops 属性

定义

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

public:
 property bool UseTabStops { bool get(); void set(bool value); };
public bool UseTabStops { get; set; }
member this.UseTabStops : bool with get, set
Public Property UseTabStops As Boolean

属性值

Boolean

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

示例

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

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.Items.Add("Item\t" + x.ToString());
    }
    // Make the ListBox display tabs within each item.
    listBox1.UseTabStops = true;
    this.Controls.Add(listBox1);
}
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

适用于