当我从事新的Windows窗体项目时,我只是意识到我无法更改窗体以及该窗体属性中的其他所有内容。代码没有错误,但是没有任何变化。
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Form1 a = new Form1();
Application.Run(a);
//this is where program happen and at some point in this program i want to
//change the size of the form
a.Size = new System.Drawing.Size(40,40);
}
所以我只想直接在Main()中有条件地更改表单,文本框等的任何属性。谢谢!