DataGrid.ResetHeaderBackColor 메서드

정의

HeaderBackColor 속성을 기본값으로 다시 설정합니다.

public:
 void ResetHeaderBackColor();
public void ResetHeaderBackColor ();
member this.ResetHeaderBackColor : unit -> unit
Public Sub 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.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 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

' Reset the header background color.
Private Sub button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button2.Click
    myDataGrid.ResetHeaderBackColor()
End Sub

설명

일반적으로 디자이너를 만들거나 컨트롤을 통합하는 고유한 컨트롤을 System.Windows.Forms.DataGrid 만드는 경우 이 메서드를 System.Windows.Forms.DataGrid사용합니다. 이 메서드를 ShouldSerializeHeaderBackColor 사용하여 속성 값이 기본값에서 변경되었는지 여부를 확인할 수 있습니다.

적용 대상