DataGridTableStyle.ResetBackColor 方法

BackColor 属性重置为其默认值。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
Public Sub ResetBackColor
用法
Dim instance As DataGridTableStyle

instance.ResetBackColor
public void ResetBackColor ()
public:
void ResetBackColor ()
public void ResetBackColor ()
public function ResetBackColor ()

备注

如果要创建 DataGridTableStyle 的设计器或创建您自己的、包含 DataGridTableStyle 的控件,则通常使用此方法。

示例

Private Sub AddCustomColumnStyle()
   ' Set the TableStyle Mapping name.
   myTableStyle.MappingName = "customerTable"
   myTableStyle.BackColor = Color.Pink
   
   ' Set the ColumnStyle properties and add to TableStyle.
   myColumnStyle.MappingName = "Customers"
   myColumnStyle.HeaderText = "Customer Name"
   myColumnStyle.Width = 250
   myTableStyle.GridColumnStyles.Add(myColumnStyle)
   myDataGrid.TableStyles.Add(myTableStyle)
End Sub 'AddCustomColumnStyle


Private Sub myButton1_Click(sender As Object, e As EventArgs)
   ' Reset the background color.
   myTableStyle.ResetBackColor()
End Sub 'myButton1_Click
private void AddCustomColumnStyle()
{
   // Set the TableStyle Mapping name.
   myTableStyle.MappingName = "customerTable";
   myTableStyle.BackColor = Color.Pink;

   // Set the ColumnStyle properties and add to TableStyle.
   myColumnStyle.MappingName = "Customers";
   myColumnStyle.HeaderText = "Customer Name";
   myColumnStyle.Width = 250;
   myTableStyle.GridColumnStyles.Add(myColumnStyle);
   myDataGrid.TableStyles.Add(myTableStyle);
}

private void myButton1_Click(object sender, EventArgs e)
{
   // Reset the background color.
   myTableStyle.ResetBackColor();
}
private:
   void AddCustomColumnStyle()
   {
      // Set the TableStyle Mapping name.
      myTableStyle->MappingName = "customerTable";
      myTableStyle->BackColor = Color::Pink;
      
      // Set the ColumnStyle properties and add to TableStyle.
      myColumnStyle->MappingName = "Customers";
      myColumnStyle->HeaderText = "Customer Name";
      myColumnStyle->Width = 250;
      myTableStyle->GridColumnStyles->Add( myColumnStyle );
      myDataGrid->TableStyles->Add( myTableStyle );
   }

   void myButton1_Click( Object^ /*sender*/, EventArgs^ /*e*/ )
   {
      // Reset the background color.
      myTableStyle->ResetBackColor();
   }
private void AddCustomColumnStyle()
{
    // Set the TableStyle Mapping name.
    myTableStyle.set_MappingName("customerTable");
    myTableStyle.set_BackColor(Color.get_Pink());

    // Set the ColumnStyle properties and add to TableStyle.
    myColumnStyle.set_MappingName("Customers");
    myColumnStyle.set_HeaderText("Customer Name");
    myColumnStyle.set_Width(250);
    myTableStyle.get_GridColumnStyles().Add(myColumnStyle);
    myDataGrid.get_TableStyles().Add(myTableStyle);
} //AddCustomColumnStyle

private void myButton1_Click(Object sender, EventArgs e)
{
    // Reset the background color.
    myTableStyle.ResetBackColor();
} //myButton1_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 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

DataGridTableStyle 类
DataGridTableStyle 成员
System.Windows.Forms 命名空间