DataGrid.FlatMode Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Gets or sets a value indicating whether the grid displays in flat mode.
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
Property Value
true
if the grid is displayed flat; otherwise, false
. The default is false
.
Examples
The following code example examines the FlatMode property and notifies the user of its status.
// 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)
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)
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)
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)
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
Applies to
Συνεργαστείτε μαζί μας στο GitHub
Μπορείτε να βρείτε την πηγή για αυτό το περιεχόμενο στο GitHub, όπου μπορείτε επίσης να δημιουργήσετε και να εξετάσετε ζητήματα και αιτήματα έλξης. Για περισσότερες πληροφορίες, ανατρέξτε στον οδηγό συνεργατών.