DataGrid.SelectionBackColor 屬性

定義

取得或設定選取資料列的背景色彩。

public:
 property System::Drawing::Color SelectionBackColor { System::Drawing::Color get(); void set(System::Drawing::Color value); };
public System.Drawing.Color SelectionBackColor { get; set; }
member this.SelectionBackColor : System.Drawing.Color with get, set
Public Property SelectionBackColor As Color

屬性值

Color

Color,代表選取資料列的背景色彩。 預設值為 ActiveCaption 色彩。

範例

下列程式碼範例示範如何使用這個成員。

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

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

// Reset selection background color to default.
myDataGrid->ResetSelectionBackColor();
myString = String::Concat( myString, " to " );
myString = String::Concat( myString, myDataGrid->SelectionBackColor.ToString() );

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

備註

如果您要為 建立設計工具 System.Windows.Forms.DataGrid ,或建立自己的控制項並 System.Windows.Forms.DataGrid 入 ,您通常會使用這個方法。

適用於