DataGridTableStyle.DataGrid 屬性

定義

取得或設定繪製資料表的 DataGrid 控制項。

public:
 virtual property System::Windows::Forms::DataGrid ^ DataGrid { System::Windows::Forms::DataGrid ^ get(); void set(System::Windows::Forms::DataGrid ^ value); };
[System.ComponentModel.Browsable(false)]
public virtual System.Windows.Forms.DataGrid DataGrid { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.DataGrid : System.Windows.Forms.DataGrid with get, set
Public Overridable Property DataGrid As DataGrid

屬性值

DataGrid

顯示資料表的 DataGrid 控制項。

屬性

範例

下列程式碼範例會列印 CurrentCell 顯示 DataGridTableStyleSystem.Windows.Forms.DataGrid

private:
   void GetSelectedIndex( DataGridTableStyle^ myGridTable )
   {
      /* Get the name of the DataGrid of the DataGridTable 
         passed as an argument. */
      Console::WriteLine( myGridTable->DataGrid->CurrentCell.ToString() );
   }
private void GetSelectedIndex(DataGridTableStyle myGridTable)
{
   /* Get the name of the DataGrid of the DataGridTable 
      passed as an argument. */
   Console.WriteLine(myGridTable.DataGrid.CurrentCell.ToString());
}
Private Sub GetSelectedIndex(myGridTable As DataGridTableStyle)
    ' Get the name of the DataGrid of the DataGridTable 
    ' passed as an argument. 
    Console.WriteLine(myGridTable.DataGrid.CurrentCell.ToString())
End Sub

備註

System.Windows.Forms.DataGrid控制項會以方格的形式顯示資料。 DataGridTableStyle是表示繪製格線的物件。 屬性 System.Windows.Forms.DataGrid 會傳回顯示方格之控制項的參考。

當 新增至 System.Windows.Forms.DataGrid 控制項的 GridTableStylesCollectionDataGridTableStyle ,就會 DataGrid 設定 屬性。 除非您覆寫此屬性並建立包含 DataGrid 控制項的使用者控制項設計工具,否則不應該嘗試設定此屬性。

適用於