Freigeben über


DataGrid.ResetHeaderBackColor-Methode

Setzt die HeaderBackColor-Eigenschaft auf ihren Standardwert zurück.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

Syntax

'Declaration
Public Sub ResetHeaderBackColor
'Usage
Dim instance As DataGrid

instance.ResetHeaderBackColor
public void ResetHeaderBackColor ()
public:
void ResetHeaderBackColor ()
public void ResetHeaderBackColor ()
public function ResetHeaderBackColor ()

Hinweise

Diese Methode wird i. d. R. zum Erstellen eines Designers für das System.Windows.Forms.DataGrid oder eines eigenen Steuerelements verwendet, das das System.Windows.Forms.DataGrid aufnimmt. Mithilfe der ShouldSerializeHeaderBackColor-Methode können Sie bestimmen, ob der Wert der Eigenschaft vom Standardwert geändert wurde.

Beispiel

Private Sub button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button1.Click
    Dim myColorDialog As New ColorDialog()
    ' Disable selecting a custom color.
    myColorDialog.AllowFullOpen = False
    ' Enable the help button.
    myColorDialog.ShowHelp = True
    ' Set the initial color to the current color.
    myColorDialog.Color = myDataGrid.HeaderBackColor
    ' Show color dialog box.
    myColorDialog.ShowDialog()
    ' Set the header background color.   
    myDataGrid.HeaderBackColor = myColorDialog.Color
End Sub 'button1_Click

' Reset the header background color.
Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button2.Click
    myDataGrid.ResetHeaderBackColor()
End Sub 'button2_Click
private void button1_Click(object sender, EventArgs e)
{
   ColorDialog myColorDialog = new ColorDialog();
   // Disable selecting a custom color.
   myColorDialog.AllowFullOpen = false ;
   // Enable the help button.
   myColorDialog.ShowHelp = true ;
   // Set the initial color to the current color.
   myColorDialog.Color = myDataGrid.HeaderBackColor;
   // Show color dialog box.
   myColorDialog.ShowDialog();
   // Set the header background color.   
   myDataGrid.HeaderBackColor  = myColorDialog.Color;
   
}
// Reset the header background color.
private void button2_Click(object sender, EventArgs e)
{           
   myDataGrid.ResetHeaderBackColor();
}
private:
   void button1_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      ColorDialog^ myColorDialog = gcnew ColorDialog;

      // Disable selecting a custom color.
      myColorDialog->AllowFullOpen = false;

      // Enable the help button.
      myColorDialog->ShowHelp = true;

      // Set the initial color to the current color.
      myColorDialog->Color = myDataGrid->HeaderBackColor;

      // Show color dialog box.
      myColorDialog->ShowDialog();

      // Set the header background color.
      myDataGrid->HeaderBackColor = myColorDialog->Color;
   }

   // Reset the header background color.
   void button2_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      myDataGrid->ResetHeaderBackColor();
   }
private void button1_Click(Object sender, EventArgs e)
{
    ColorDialog myColorDialog = new ColorDialog();
    
    // Disable selecting a custom color.
    myColorDialog.set_AllowFullOpen(false);
    
    // Enable the help button.
    myColorDialog.set_ShowHelp(true);
    
    // Set the initial color to the current color.
    myColorDialog.set_Color(myDataGrid.get_HeaderBackColor());
    
    // Show color dialog box.
    myColorDialog.ShowDialog();
    
    // Set the header background color.   
    myDataGrid.set_HeaderBackColor(myColorDialog.get_Color());
} //button1_Click

// Reset the header background color.
private void button2_Click(Object sender, EventArgs e)
{
    myDataGrid.ResetHeaderBackColor();
} //button2_Click

Plattformen

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

DataGrid-Klasse
DataGrid-Member
System.Windows.Forms-Namespace