TextBoxBase.BackColor 属性


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

 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. 例如,如果 BackColor 和属性都 ForeColor 设置为 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 trueThis property might be over ridden if the ReadOnly property of the TextBoxBase is set to true.