DataGrid.FlatMode 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定值,表示是否以一般模式顯示方格。
public:
property bool FlatMode { bool get(); void set(bool value); };
public bool FlatMode { get; set; }
member this.FlatMode : bool with get, set
Public Property FlatMode As Boolean
屬性值
如果方格顯示為一般模式則為 true
,否則為 false
。 預設為 false
。
範例
下列程式碼範例會 FlatMode 檢查 屬性,並通知使用者其狀態。
// Attach to event handler.
private:
void AttachFlatModeChanged()
{
this->myDataGrid->FlatModeChanged +=
gcnew EventHandler( this, &MyDataGridClass_FlatMode_ReadOnly::myDataGrid_FlatModeChanged );
}
// Check if the 'FlatMode' property is changed.
void myDataGrid_FlatModeChanged( Object^ /*sender*/, EventArgs^ /*e*/ )
{
String^ strMessage = "false";
if ( myDataGrid->FlatMode == true )
strMessage = "true";
MessageBox::Show( "Flat mode changed to " + strMessage, "Message", MessageBoxButtons::OK, MessageBoxIcon::Exclamation );
}
// Toggle the 'FlatMode'.
void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
{
if ( myDataGrid->FlatMode == true )
myDataGrid->FlatMode = false;
else
myDataGrid->FlatMode = true;
}
// Attach to event handler.
private void AttachFlatModeChanged()
{
this.myDataGrid.FlatModeChanged += new EventHandler(this.myDataGrid_FlatModeChanged);
}
// Check if the 'FlatMode' property is changed.
private void myDataGrid_FlatModeChanged(object sender, EventArgs e)
{
string strMessage = "false";
if(myDataGrid.FlatMode == true)
strMessage = "true";
MessageBox.Show("Flat mode changed to "+strMessage,
"Message", MessageBoxButtons.OK,
MessageBoxIcon.Exclamation);
}
// Toggle the 'FlatMode'.
private void button1_Click(object sender, EventArgs e)
{
if(myDataGrid.FlatMode == true)
myDataGrid.FlatMode = false;
else
myDataGrid.FlatMode = true;
}
' Check if the 'FlatMode' property is changed.
Private Sub myDataGrid_FlatModeChanged(ByVal sender As Object, ByVal e As EventArgs) Handles myDataGrid.FlatModeChanged
Dim strMessage As String = "false"
If myDataGrid.FlatMode = True Then
strMessage = "true"
End If
MessageBox.Show("Flat mode changed to " + strMessage, "Message", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Sub
' Toggle the 'FlatMode'.
Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
If myDataGrid.FlatMode = True Then
myDataGrid.FlatMode = False
Else
myDataGrid.FlatMode = True
End If
End Sub