Control.DefaultForeColor プロパティ
定義
コントロールの既定の前景色を取得します。Gets the default foreground color of the control.
public:
static property System::Drawing::Color DefaultForeColor { System::Drawing::Color get(); };
public static System.Drawing.Color DefaultForeColor { get; }
member this.DefaultForeColor : System.Drawing.Color
Public Shared ReadOnly Property DefaultForeColor As Color
プロパティ値
コントロールの既定の前景の Color。The default foreground Color of the control. 既定値は、ControlText です。The default is ControlText.
例
次のコード例は、DefaultBackColor、DefaultFont、および DefaultForeColor メンバーを使用する方法を示しています。The following code example demonstrates how to use the DefaultBackColor, DefaultFont, and DefaultForeColor members. この例を実行するには、ListBox1 という ListBox を含むフォームに次のコードを貼り付けます。To run the example, paste the following code in a form containing a ListBox called ListBox1. フォームのコンストラクターまたは Load のイベント処理メソッドで Populate_ListBox
メソッドを呼び出します。Call the Populate_ListBox
method in the form's constructor or Load event-handling method.
// The following method displays the default font,
// background color and foreground color values for the ListBox
// control. The values are displayed in the ListBox, itself.
void Populate_ListBox()
{
ListBox1->Dock = DockStyle::Bottom;
// Display the values in the read-only properties
// DefaultBackColor, DefaultFont, DefaultForecolor.
ListBox1->Items->Add( String::Format( "Default BackColor: {0}", ListBox::DefaultBackColor ) );
ListBox1->Items->Add( String::Format( "Default Font: {0}", ListBox::DefaultFont ) );
ListBox1->Items->Add( String::Format( "Default ForeColor:{0}", ListBox::DefaultForeColor ) );
}
// The following method displays the default font,
// background color and foreground color values for the ListBox
// control. The values are displayed in the ListBox, itself.
private void Populate_ListBox()
{
ListBox1.Dock = DockStyle.Bottom;
// Display the values in the read-only properties
// DefaultBackColor, DefaultFont, DefaultForecolor.
ListBox1.Items.Add("Default BackColor: " +
ListBox.DefaultBackColor.ToString());
ListBox1.Items.Add("Default Font: " +
ListBox.DefaultFont.ToString());
ListBox1.Items.Add("Default ForeColor:" +
ListBox.DefaultForeColor.ToString());
}
' The following method displays the default font,
' background color and foreground color values for the ListBox
' control. The values are displayed in the ListBox, itself.
Private Sub Populate_ListBox()
ListBox1.Dock = DockStyle.Bottom
' Display the values in the read-only properties
' DefaultBackColor, DefaultFont, DefaultForecolor.
ListBox1.Items.Add("Default BackColor: " & ListBox.DefaultBackColor.ToString)
ListBox1.Items.Add("Default Font: " & ListBox.DefaultFont.ToString)
ListBox1.Items.Add("Default ForeColor:" & ListBox.DefaultForeColor.ToString)
End Sub
注釈
これは、親以外のコントロールの既定の ForeColor プロパティ値です。This is the default ForeColor property value of a nonparented control. 派生クラスは、異なる既定値を持つことができます。Derived classes can have different defaults.