DataGrid.ResetAlternatingBackColor Methode

Definition

Setzt die AlternatingBackColor-Eigenschaft auf ihre Standardfarbe zurück.

public:
 void ResetAlternatingBackColor();
public void ResetAlternatingBackColor ();
member this.ResetAlternatingBackColor : unit -> unit
Public Sub ResetAlternatingBackColor ()

Beispiele

Im folgenden Codebeispiel wird die Verwendung dieses Members veranschaulicht.

// String variable used to show message.
String^ myString = "Selection backgound color changed from: ";

// Store current foreground color of selected cells.
Color myCurrentColor = myDataGrid->SelectionBackColor;
myString = String::Concat( myString, myCurrentColor.ToString() );

// Reset selection background color to default.
myDataGrid->ResetSelectionBackColor();
myString = String::Concat( myString, " to " );
myString = String::Concat( myString, myDataGrid->SelectionBackColor.ToString() );

// Show information about changes in color setting.  
MessageBox::Show( myString, "Selection background color information" );
// String variable used to show message.
string myString = "Selection backgound color changed from: ";
// Store current foreground color of selected cells.
Color myCurrentColor = myDataGrid.SelectionBackColor;
myString += myCurrentColor.ToString();
// Reset selection background color to default.
myDataGrid.ResetSelectionBackColor();
myString += "  to ";
myString += myDataGrid.SelectionBackColor.ToString();
// Show information about changes in color setting.  
MessageBox.Show(myString, "Selection background color information");
' String variable used to show message.
Dim myString As String = "Selection backgound color changed from: "
' Store current foreground color of selected cells.
Dim myCurrentColor As Color = myDataGrid.SelectionBackColor
myString += myCurrentColor.ToString()
' Reset selection background color to default.
myDataGrid.ResetSelectionBackColor()
myString += "  to "
myString += myDataGrid.SelectionBackColor.ToString()
' Show information about changes in color setting.  
MessageBox.Show(myString, "Selection background color information")

Hinweise

In der Regel verwenden Sie diese Methode, wenn Sie entweder einen Designer für oder ein eigenes System.Windows.Forms.DataGrid Steuerelement erstellen, das das System.Windows.Forms.DataGrid-Steuerelement enthält. Sie können die ShouldSerializeAlternatingBackColor -Methode verwenden, um zu bestimmen, ob sich der Eigenschaftswert gegenüber dem Standardwert geändert hat.

Gilt für:

Weitere Informationen