DataGridTableStyle.ResetForeColor 方法

定义

ForeColor 属性重置为其默认值。

public:
 void ResetForeColor();
public void ResetForeColor ();
member this.ResetForeColor : unit -> unit
Public Sub ResetForeColor ()

示例

下面的代码示例演示了此成员的用法。

private:
   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();
   }
 private void BtnSetForeColor_Click(Object sender, EventArgs e)
 {
    // Set the foreground color of table.
    myDataGridTableStyle.ForeColor=Color.Blue;
    myDataGrid.TableStyles.Add(myDataGridTableStyle);
 }
private void BtnResetForeColor_Click(Object sender, EventArgs e)
{
   // Reset the foreground color of table to its default value.
   myDataGridTableStyle.ResetForeColor();
}
  Private Sub BtnSetForeColor_Click(ByVal sender As Object, ByVal e As EventArgs)
      ' Set the foreground color of table.
      myDataGridTableStyle.ForeColor = Color.Blue
      myDataGrid.TableStyles.Add(myDataGridTableStyle)
  End Sub

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

注解

如果要为 DataGridTableStyle 创建设计器或创建自己的包含 的 DataGridTableStyle控件,则通常使用此方法。 可以使用 ShouldSerializeForeColor 方法确定属性值是否已从其默认值更改。

适用于