1

我正在研究 WPF,我想更改背景---文本框的颜色(txtStatus.Background= 白色),但它给出了错误。这里我的代码是:

public Window2()
            {
                InitializeComponent();
                txtStatus.Text = "Current Operation: NULL";
                txtStatus.Background= white
            }
4

1 回答 1

7

您需要使用Brushes

txtStatus.Foreground = Brushes.White;

它包含很多颜色,但如果你想使用 aRGB 值,那么你可以这样做:

txtStatus.Foreground = new SolidBrush(Color.FromArgb(255, 0, 0, 255));
于 2013-07-01T15:41:38.680 回答