次の方法で共有


DataGridTableStyle.ResetForeColor メソッド

ForeColor プロパティを既定値にリセットします。

Public Sub ResetForeColor()
[C#]
public void ResetForeColor();
[C++]
public: void ResetForeColor();
[JScript]
public function ResetForeColor();

解説

通常、 DataGridTableStyle のデザイナまたは DataGridTableStyle を組み込んだ独自のコントロールを作成する場合に、このメソッドを使用します。 ShouldSerializeForeColor メソッドを使用すると、プロパティの値が既定値から変更されたかどうかを確認できます。

使用例

 
Sub BtnSetForeColor_Click(sender As Object, e As EventArgs)
   ' Set the foreground color of table.
   myDataGridTableStyle.ForeColor = Color.Blue
   myDataGrid.TableStyles.Add(myDataGridTableStyle)
End Sub 'BtnSetForeColor_Click

Sub BtnResetForeColor_Click(sender As Object, e As EventArgs)
   ' Reset the foreground color of table to its default value.
   myDataGridTableStyle.ResetForeColor()
End Sub 'BtnResetForeColor_Click

[C#] 
void BtnSetForeColor_Click(Object sender, EventArgs e)
{
   // Set the foreground color of table.
   myDataGridTableStyle.ForeColor=Color.Blue;
   myDataGrid.TableStyles.Add(myDataGridTableStyle);
}
           void BtnResetForeColor_Click(Object sender, EventArgs e)
           {
  // Reset the foreground color of table to its default value.
  myDataGridTableStyle.ResetForeColor();
           }

[C++] 
void BtnSetForeColor_Click(Object* /*sender*/, EventArgs* /*e*/) {
    // Set the foreground color of table.
    myDataGridTableStyle->ForeColor=Color::Blue;
    myDataGrid->TableStyles->Add(myDataGridTableStyle);
}
void BtnResetForeColor_Click(Object* /*sender*/, EventArgs* /*e*/) {
    // Reset the foreground color of table to its default value.
    myDataGridTableStyle->ResetForeColor();
}

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

DataGridTableStyle クラス | DataGridTableStyle メンバ | System.Windows.Forms 名前空間