DataGrid.ResetHeaderBackColor メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)


通常、System.Windows.Forms.DataGrid のデザイナを作成する場合、または System.Windows.Forms.DataGrid が組み込まれている独自のコントロールを作成する場合に、このメソッドを使用します。ShouldSerializeHeaderBackColor メソッドを使用して、プロパティの値が既定値から変更されたかどうかを判断します。

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

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- DataGrid.ResetHeaderBackColor メソッドのページへのリンク