TextBoxBase.BackColor TextBoxBase.BackColor TextBoxBase.BackColor TextBoxBase.BackColor Property

定义

获取或设置控件的背景色。Gets or sets the background color of the control.

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

属性值

表示控件背景色的 ColorA Color that represents the background of the control.

注解

您可以使用BackColor属性更改文本控件的背景色,以将其与窗体的配色方案混合。You can use the BackColor property to change the background color of the text control to blend into the color scheme of your forms.

若要更改控件中的文本的颜色,请使用ForeColor属性。To change the color of the text within the control, use the ForeColor property. 设置文本控件BackColor的属性时,请确保所选颜色不会导致控件文本消失。When setting the BackColor property of your text control, ensure that the color you choose does not cause the text of the control to disappear. 例如,如果BackColorForeColor属性都设置为Color.Black,则 textbox 控件中的文本将不可见。For example, if the BackColor and ForeColor properties are both set to Color.Black, the text within your textbox control will not be visible.

如果ReadOnly将的TextBoxBase属性设置为true,则此属性可能会超过替代。This property might be over ridden if the ReadOnly property of the TextBoxBase is set to true.

适用于

另请参阅