DataGrid.ResetHeaderForeColor メソッド
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文
解説
通常、System.Windows.Forms.DataGrid のデザイナを作成する場合、または System.Windows.Forms.DataGrid が組み込まれている独自のコントロールを作成する場合に、このメソッドを使用します。ShouldSerializeHeaderForeColor メソッドを使用して、プロパティの値が既定値から変更されたかどうかを判断します。
Private Sub button3_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button3.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.HeaderForeColor ' Show color dialog box. myColorDialog.ShowDialog() ' Set the header foreground color. myDataGrid.HeaderForeColor = myColorDialog.Color End Sub 'button3_Click ' Reset the header foregroundcolor. Private Sub button4_Click(ByVal sender As Object, ByVal e As EventArgs) Handles button4.Click myDataGrid.ResetHeaderForeColor() End Sub 'button4_Click
private void button3_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.HeaderForeColor; // Show color dialog box. myColorDialog.ShowDialog(); // Set the header foreground color. myDataGrid.HeaderForeColor = myColorDialog.Color; } // Reset the header foregroundcolor. private void button4_Click(object sender, EventArgs e) { myDataGrid.ResetHeaderForeColor(); }
private: void button3_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->HeaderForeColor; // Show color dialog box. myColorDialog->ShowDialog(); // Set the header foreground color. myDataGrid->HeaderForeColor = myColorDialog->Color; } // Reset the header foregroundcolor. void button4_Click( Object^ /*sender*/, EventArgs^ /*e*/ ) { myDataGrid->ResetHeaderForeColor(); }
private void button3_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_HeaderForeColor()); // Show color dialog box. myColorDialog.ShowDialog(); // Set the header foreground color. myDataGrid.set_HeaderForeColor(myColorDialog.get_Color()); } //button3_Click // Reset the header foregroundcolor. private void button4_Click(Object sender, EventArgs e) { myDataGrid.ResetHeaderForeColor(); } //button4_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.ResetHeaderForeColor メソッドのページへのリンク