Set form backcolor to custom color

后端 未结 2 383
Happy的楠姐
Happy的楠姐 2020-12-29 03:42

How can I set a form\'s backcolor to a custom color (such as light pink) using C# code?

2条回答
  •  忘掉有多难
    2020-12-29 04:02

    With Winforms you can use Form.BackColor to do this.
    From within the Form's code:

    BackColor = Color.LightPink;
    

    If you mean a WPF Window you can use the Background property.
    From within the Window's code:

    Background = Brushes.LightPink;
    

提交回复
热议问题