DataGridTableStyle.ResetBackColor Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Resets the BackColor property to its default value.
public:
void ResetBackColor();
public void ResetBackColor ();
member this.ResetBackColor : unit -> unit
Public Sub ResetBackColor ()
Examples
The following code example demonstrates the use of this member.
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.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 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
Private Sub myButton1_Click(sender As Object, e As EventArgs)
' Reset the background color.
myTableStyle.ResetBackColor()
End Sub
Remarks
You typically use this method if you are either creating a designer for the DataGridTableStyle or creating your own control incorporating the DataGridTableStyle.
Applies to
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應