DataGridTableStyle.RowHeadersVisible 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置一个值,该值指示行标题是否可见。
public:
property bool RowHeadersVisible { bool get(); void set(bool value); };
public bool RowHeadersVisible { get; set; }
member this.RowHeadersVisible : bool with get, set
Public Property RowHeadersVisible As Boolean
属性值
如果行标题可见,则为 true
;否则为 false
。 默认值为 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.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 Sub AttachRowHeaderVisibleChanged()
AddHandler myDataGridTableStyle.RowHeadersVisibleChanged, AddressOf MyDelegateRowHeadersVisibleChanged
End Sub
' 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
' 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
注解
当行标题可见时,如果基础 DataTable 具有相关的子表,则会在每个行标题中显示加号。
在向 . 添加 DataGridTableStyle 对象 GridTableStylesCollection之前,此属性将不起作用。 在此之前,设置此属性将不起作用。