DataGridTableStyle.ResetSelectionForeColor 方法

定义

SelectionForeColor 属性重置为其默认值。

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

示例

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

// String variable used to show message.
String^ myString = "Fore color changed from: ";

// Store current foreground color of selected cells.
Color myCurrentColor = customersStyle->SelectionForeColor;
myString = String::Concat( myString, myCurrentColor );

// Reset selection fore color to default.
customersStyle->ResetSelectionForeColor();
myString = String::Concat( myString, "  to " );
myString = String::Concat( myString, customersStyle->SelectionForeColor );

// Show information about changes in color setting.
MessageBox::Show( myString, "Selection fore color information" );
// String variable used to show message.   
string myString = "Fore color changed from: ";
// Store current foreground color of selected cells.
Color myCurrentColor = customersStyle.SelectionForeColor;
myString += myCurrentColor.ToString();
// Reset selection fore color to default.
customersStyle.ResetSelectionForeColor();
myString += "  to ";
myString += customersStyle.SelectionForeColor.ToString();
// Show information about changes in color setting.  
MessageBox.Show(myString, "Selection fore color information");
' String variable used to show message.   
Dim myString As String = "Fore color changed from: "
' Store current foreground color of selected cells.
Dim myCurrentColor As Color = customersStyle.SelectionForeColor
myString += myCurrentColor.ToString()
' Reset selection fore color to default.
customersStyle.ResetSelectionForeColor()
myString += "  to "
myString += customersStyle.SelectionForeColor.ToString()
' Show information about changes in color setting.  
MessageBox.Show(myString, "Selection fore color information")

注解

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

适用于

另请参阅