DataGridTableStyle.DataGrid 属性

获取或设置所绘制表的 System.Windows.Forms.DataGrid 控件。

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

语法

声明
Public Overridable Property DataGrid As DataGrid
用法
Dim instance As DataGridTableStyle
Dim value As DataGrid

value = instance.DataGrid

instance.DataGrid = value
public virtual DataGrid DataGrid { get; set; }
public:
virtual property DataGrid^ DataGrid {
    DataGrid^ get ();
    void set (DataGrid^ value);
}
/** @property */
public DataGrid get_DataGrid ()

/** @property */
public void set_DataGrid (DataGrid value)
public function get DataGrid () : DataGrid

public function set DataGrid (value : DataGrid)

属性值

显示该表的 System.Windows.Forms.DataGrid 控件。

备注

System.Windows.Forms.DataGrid 控件以网格形式显示数据。DataGridTableStyle 是代表所绘制网格的对象。System.Windows.Forms.DataGrid 属性返回对正在显示网格的控件的引用。

System.Windows.Forms.DataGrid 控件的 GridTableStylesCollection 添加 DataGridTableStyle 时,将设置 DataGrid 属性。除非正在重写该属性,并为包含 DataGrid 控件的用户控件创建设计器,否则不能尝试设置此属性。

示例

下面的代码示例打印显示了 DataGridTableStyleSystem.Windows.Forms.DataGridCurrentCell

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 'GetSelectedIndex
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 void GetSelectedIndex(DataGridTableStyle myGridTable)
{
    /*  Get the name of the DataGrid of the DataGridTable 
        passed as an argument. 
     */
    Console.WriteLine(myGridTable.get_DataGrid().
        get_CurrentCell().ToString());
} //GetSelectedIndex

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、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

请参见

参考

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