DataGridTableStyle.RowHeadersVisible 属性

获取或设置一个值,该值指示行标头是否可见。

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

语法

声明
Public Property RowHeadersVisible As Boolean
用法
Dim instance As DataGridTableStyle
Dim value As Boolean

value = instance.RowHeadersVisible

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

/** @property */
public void set_RowHeadersVisible (boolean value)
public function get RowHeadersVisible () : boolean

public function set RowHeadersVisible (value : boolean)

属性值

如果行标头可见,则为 true;否则为 false。默认为 true

备注

在行标头可见时,如果基础 DataTable 有相关的子表,则会在每个行标头中均显示加号。

直到向 GridTableStylesCollection 添加 DataGridTableStyle 对象后,此属性才能起作用。在此之前设置此属性无效。

示例

' Instantiate the EventHandler.
Public Sub AttachRowHeaderVisibleChanged()
   AddHandler myDataGridTableStyle.RowHeadersVisibleChanged, AddressOf MyDelegateRowHeadersVisibleChanged
End Sub 'AttachRowHeaderVisibleChanged


' raise the event when RowHeadersVisible property is changed.
 Private Sub MyDelegateRowHeadersVisibleChanged(ByVal sender As Object, ByVal e As EventArgs)
     Dim myString As String = "'RowHeadersVisibleChanged' event raised, Row Headers are"
     If myDataGridTableStyle.RowHeadersVisible Then
         myString += " visible"
     Else
         myString += " not visible"
     End If
     MessageBox.Show(myString, "RowHeader information")
 End Sub 'MyDelegateRowHeadersVisibleChanged


' raise the event when a button is clicked.
Private Sub myButton_Click(sender As Object, e As System.EventArgs)
   If myDataGridTableStyle.RowHeadersVisible Then
      myDataGridTableStyle.RowHeadersVisible = False
   Else
      myDataGridTableStyle.RowHeadersVisible = True
   End If
End Sub 'myButton_Click 
// Instantiate the EventHandler.
public void AttachRowHeaderVisibleChanged()
{
   myDataGridTableStyle.RowHeadersVisibleChanged += new EventHandler (MyDelegateRowHeadersVisibleChanged);
}

// raise the event when RowHeadersVisible property is changed.
private void MyDelegateRowHeadersVisibleChanged(object sender, EventArgs e)
{
   string myString = "'RowHeadersVisibleChanged' event raised, Row Headers are";
   if (myDataGridTableStyle.RowHeadersVisible)
      myString += " visible";
   else
      myString += " not visible";

   MessageBox.Show(myString, "RowHeader information");
}

// raise the event when a button is clicked.
private void myButton_Click(object sender, System.EventArgs e)
{
   if (myDataGridTableStyle.RowHeadersVisible)
      myDataGridTableStyle.RowHeadersVisible = false;
   else
      myDataGridTableStyle.RowHeadersVisible = true;
}
   // Instantiate the EventHandler.
public:
   void AttachRowHeaderVisibleChanged()
   {
      myDataGridTableStyle->RowHeadersVisibleChanged += gcnew EventHandler( this, &MyDataGridTableStyle_RowHeadersVisibleChanged::MyDelegateRowHeadersVisibleChanged );
   }

   // raise the event when RowHeadersVisible property is changed.
private:
   void MyDelegateRowHeadersVisibleChanged( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      String^ myString = "'RowHeadersVisibleChanged' event raised, Row Headers are";
      if ( myDataGridTableStyle->RowHeadersVisible )
            myString = String::Concat( myString, " visible" );
      else
            myString = String::Concat( myString, " not visible" );

      MessageBox::Show( myString, "RowHeader information" );
   }

   // raise the event when a button is clicked.
   void myButton_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      if ( myDataGridTableStyle->RowHeadersVisible )
            myDataGridTableStyle->RowHeadersVisible = false;
      else
            myDataGridTableStyle->RowHeadersVisible = true;
   }
// Instantiate the EventHandler.
public void AttachRowHeaderVisibleChanged()
{
    myDataGridTableStyle.add_RowHeadersVisibleChanged(
        new EventHandler(MyDelegateRowHeadersVisibleChanged));
} //AttachRowHeaderVisibleChanged

// raise the event when RowHeadersVisible property is changed.
public void MyDelegateRowHeadersVisibleChanged(Object sender, EventArgs e)
{
    String myString = "'RowHeadersVisibleChanged' event raised, Row " 
        + "Headers are";

    if (myDataGridTableStyle.get_RowHeadersVisible()) {
        myString += " visible";
    }
    else {
        myString += " not visible";
    }
    MessageBox.Show(myString, "RowHeader information");
} //MyDelegateRowHeadersVisibleChanged

// raise the event when a button is clicked.
private void myButton_Click(Object sender, System.EventArgs e)
{
    if (myDataGridTableStyle.get_RowHeadersVisible()) {
        myDataGridTableStyle.set_RowHeadersVisible(false);
    }
    else {
        myDataGridTableStyle.set_RowHeadersVisible(true);
    }
} //myButton_Click 
// Instantiate the EventHandler.
public void AttachRowHeaderVisibleChanged()
{
    myDataGridTableStyle.add_RowHeadersVisibleChanged(new EventHandler(
        MyDelegateRowHeadersVisibleChanged));
} //AttachRowHeaderVisibleChanged

// raise the event when RowHeadersVisible property is changed.
public void MyDelegateRowHeadersVisibleChanged(Object sender, EventArgs e)
{
    String myString = 
        "'RowHeadersVisibleChanged' event raised, Row Headers are";

    if (myDataGridTableStyle.get_RowHeadersVisible()) {
        myString += " visible";
    }
    else {
        myString += " not visible";
    }
    MessageBox.Show(myString, "RowHeader information");
} //MyDelegateRowHeadersVisibleChanged

// raise the event when a button is clicked.
private void myButton_Click(Object sender, System.EventArgs e)
{
    if (myDataGridTableStyle.get_RowHeadersVisible()) {
        myDataGridTableStyle.set_RowHeadersVisible(false);
    }
    else {
        myDataGridTableStyle.set_RowHeadersVisible(true);
    }
} //myButton_Click 

平台

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 命名空间
RowHeadersVisibleChanged
RowHeaderWidth