PropertyGrid.ToolbarVisible 屬性

定義

取得或設定值,指出工具列是否為可見。Gets or sets a value indicating whether the toolbar is visible.

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

屬性值

Boolean

如果工具列為可見的,則為 true,否則為 falsetrue if the toolbar is visible; otherwise, false. 預設為 trueThe default is true.

範例

下列程式碼範例將示範如何 PropertyGrid 使用、屬性來初始化控制項 PropertySort ToolbarVisibleThe following code example demonstrates initializing a PropertyGrid control using the PropertySort, ToolbarVisible properties. 此外,這個範例 PropertyGrid 會將控制項的 Visible 屬性設為,因此在執行此 false 範例時,不會顯示方格。In addition, this example sets the PropertyGrid control's Visible property to false so the grid will not be visible when the example is run. 若要執行此範例,請在表單中貼上下列程式碼,並 InitializePropertyGrid 從表單的函 Load 式或事件處理方法中呼叫方法。To run this example paste the following code in a form and call the InitializePropertyGrid method from the form's constructor or Load event-handling method. 若要在表單執行時查看屬性方格,請將方格的 Visible 屬性變更為 true 、重新編譯,然後重新執行表單。To view the property grid when the form is running, change the grid's Visible property to true, recompile, and rerun the form.

   // Declare a propertyGrid.
internal:
   PropertyGrid^ propertyGrid1;

private:

   // Initialize propertyGrid1.
   [PermissionSetAttribute(SecurityAction::Demand, Name="FullTrust")]
   void InitializePropertyGrid()
   {
      propertyGrid1 = gcnew PropertyGrid;
      propertyGrid1->Name = "PropertyGrid1";
      propertyGrid1->Location = System::Drawing::Point( 185, 20 );
      propertyGrid1->Size = System::Drawing::Size( 150, 300 );
      propertyGrid1->TabIndex = 5;
      
      // Set the sort to alphabetical and set Toolbar visible
      // to false, so the user cannot change the sort.
      propertyGrid1->PropertySort = PropertySort::Alphabetical;
      propertyGrid1->ToolbarVisible = false;
      propertyGrid1->Text = "Property Grid";
      
      // Add the PropertyGrid to the form, but set its
      // visibility to False so it will not appear when the form loads.
      propertyGrid1->Visible = false;
      this->Controls->Add( propertyGrid1 );
   }

// Declare a propertyGrid.
internal PropertyGrid propertyGrid1;

// Initialize propertyGrid1.
private void InitializePropertyGrid()
{
    propertyGrid1 = new PropertyGrid();
    propertyGrid1.Name = "PropertyGrid1";
    propertyGrid1.Location = new System.Drawing.Point(185, 20);
    propertyGrid1.Size = new System.Drawing.Size(150, 300);
    propertyGrid1.TabIndex = 5;

    // Set the sort to alphabetical and set Toolbar visible
    // to false, so the user cannot change the sort.
    propertyGrid1.PropertySort = PropertySort.Alphabetical;
    propertyGrid1.ToolbarVisible = false;
    propertyGrid1.Text = "Property Grid";

    // Add the PropertyGrid to the form, but set its
    // visibility to False so it will not appear when the form loads.
    propertyGrid1.Visible = false;
    this.Controls.Add(propertyGrid1);
}

'Declare a propertyGrid.
Friend WithEvents propertyGrid1 As PropertyGrid

'Initialize propertyGrid1.
Private Sub InitializePropertyGrid()
    propertyGrid1 = New PropertyGrid
    propertyGrid1.Name = "PropertyGrid1"
    propertyGrid1.Location = New Point(185, 20)
    propertyGrid1.Size = New System.Drawing.Size(150, 300)
    propertyGrid1.TabIndex = 5

    'Set the sort to alphabetical and set Toolbar visible
    'to false, so the user cannot change the sort.
    propertyGrid1.PropertySort = PropertySort.Alphabetical
    propertyGrid1.ToolbarVisible = False
    propertyGrid1.Text = "Property Grid"

    ' Add the PropertyGrid to the form, but set its
    ' visibility to False so it will not appear when the form loads.
    propertyGrid1.Visible = False
    Me.Controls.Add(propertyGrid1)

End Sub

適用於