DataGridTableStyle.ResetSelectionForeColor 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
重設 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 方法來判斷屬性值是否已從預設值變更。