Proprietà DataGrid.FlatMode
.NET Framework 2.0
Ottiene o imposta un valore che indica se la griglia viene visualizzata in modalità semplice.
Spazio dei nomi: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)
Assembly: System.Windows.Forms (in system.windows.forms.dll)
/** @property */ public boolean get_FlatMode () /** @property */ public void set_FlatMode (boolean value)
public function get FlatMode () : boolean public function set FlatMode (value : boolean)
Valore proprietà
true se la griglia viene visualizzata in modalità semplice; in caso contrario, false. Il valore predefinito è false.Nell'esempio di codice riportato di seguito viene esaminata la proprietà FlatMode, il cui stato viene notificato all'utente.
// 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; }
// Attach to event handler.
private void AttachFlatModeChanged()
{
this.myDataGrid.add_FlatModeChanged(new EventHandler(
this.myDataGrid_FlatModeChanged));
} //AttachFlatModeChanged
// Check if the 'FlatMode' property is changed.
private void myDataGrid_FlatModeChanged(Object sender, EventArgs e)
{
String strMessage = "false";
if (myDataGrid.get_FlatMode() == true) {
strMessage = "true";
}
MessageBox.Show("Flat mode changed to " + strMessage, "Message",
MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
} //myDataGrid_FlatModeChanged
// Toggle the 'FlatMode'.
private void button1_Click(Object sender, EventArgs e)
{
if (myDataGrid.get_FlatMode() == true) {
myDataGrid.set_FlatMode(false);
}
else {
myDataGrid.set_FlatMode(true);
}
} //button1_Click
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile per Pocket PC, Windows Mobile per Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework non supporta tutte le versioni di ciascuna piattaforma. Per un elenco delle versioni supportate, vedere Requisiti di sistema.