次の方法で共有


DataGrid.ForeColor プロパティ

System.Windows.Forms.DataGrid コントロールの前景色 (通常はテキストの色) プロパティを取得または設定します。

Overrides Public Property ForeColor As Color
[C#]
public override Color ForeColor {get; set;}
[C++]
public: __property Color get_ForeColor();public: __property void set_ForeColor(Color);
[JScript]
public override function get ForeColor() : Color;public override function set ForeColor(Color);

プロパティ値

前景色を表す Color 。既定値は WindowText 色です。

使用例

 
' 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")

[C#] 
// 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");

[C++] 
// String variable used to show message.
String* myString = S"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, S" to ");
myString = String::Concat(myString, myDataGrid->SelectionBackColor.ToString());
// Show information about changes in color setting.  
MessageBox::Show(myString, S"Selection background color information");

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, .NET Compact Framework - Windows CE .NET

参照

DataGrid クラス | DataGrid メンバ | System.Windows.Forms 名前空間