如何在C#中更改表单的颜色和大小?

时间:2012-08-01 16:56:25

标签: c# winforms

如何在C#中更改表单的颜色和大小?

  // something like
  Form1.BackColor = Color.Red;  
  From1.size = 1600,900;

4 个答案:

答案 0 :(得分:5)

this.BackColor = Color.Red;
this.Size = new Size(1600, 900);

答案 1 :(得分:1)

如果您要创建表单的实例:

Form1 form = new Form1();

form.BackColor = Color.Red;
form.Size = new Size(1600,900);

form.Show();

答案 2 :(得分:1)

 Form1.BackColor = Color.Red;
 Form1.Size = New System.Drawing.Size(1600, 900);
 Form1.Invalidate();

无效将导致表单重绘

答案 3 :(得分:0)

this.BackColor = System.Drawing.Color.Red
this.Size = new Size(100, 100)