我在 WPF 上工作,我想更改背景---文本框的颜色(txtStatus.Background= white),但它给出了错误。我的代码是:
public Window2()
{
InitializeComponent();
txtStatus.Text = "Current Operation: NULL";
txtStatus.Background= white
}
最佳答案
您需要使用画笔
:
txtStatus.Foreground = Brushes.White;
它包含很多颜色,但如果你想使用 RGB 值,那么你可以这样做:
txtStatus.Foreground = new SolidBrush(Color.FromArgb(255, 0, 0, 255));
关于c# - 如何更改文本框的背景颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17408406/