1、如果你不想让用户最大化,那设置:MaximizeBox = false;
2、使用模态窗体:ShowDialog()
3、在mdi中,你可以使用下面的方法打开子窗体:
private void OpenForm(string formName)
{
foreach(Form f in this.MdiChildren)
{
if (f.GetType() == Type.GetType(formName))
{
f.Focus();
return;
}
}
Form frm = (Form)Activator.CreateInstance(Type.GetType(formName));
frm.MdiParent = this;
frm.Show();
}
2、使用模态窗体:ShowDialog()
3、在mdi中,你可以使用下面的方法打开子窗体:
private void OpenForm(string formName)
{
foreach(Form f in this.MdiChildren)
{
if (f.GetType() == Type.GetType(formName))
{
f.Focus();
return;
}
}
Form frm = (Form)Activator.CreateInstance(Type.GetType(formName));
frm.MdiParent = this;
frm.Show();
}
2.打开字窗体时用实例化的字窗体.ShowDialog();
3.for(int i=0;i<this.MdiChildren.Length;i++)
{
if(this.MdiChildren[i].Name=="formname")
{
this.MdiChildren[i].Activate();
return;
}
}