在一个MDI窗口内,有几个不同的子窗口,有的需要打开时最大化,有的则需要保持原样。但我在菜单的单击事件中使用newMDIChild.WindowState = FormWindowState.Maximized;这样的语句后,其他的子窗口也跟着最大化了。
如果说在不需要最大化的窗口newMDIChild.Show();后加上newMDIChild.WindowState = FormWindowState.Normal;则先前打开的最大化的窗口也会跟着还原成Normal状态。
不知大家有没有好的解决办法?小弟使用的是VS2010的版本。
如果说在不需要最大化的窗口newMDIChild.Show();后加上newMDIChild.WindowState = FormWindowState.Normal;则先前打开的最大化的窗口也会跟着还原成Normal状态。
不知大家有没有好的解决办法?小弟使用的是VS2010的版本。
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace TestMdi
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void 测试窗口一ToolStripMenuItem_Click(object sender, EventArgs e)
{
Form2 newMDIChild = new Form2();
newMDIChild.MdiParent = this;
newMDIChild.WindowState = FormWindowState.Maximized;
newMDIChild.Show();
} private void 测试窗口二ToolStripMenuItem_Click(object sender, EventArgs e)
{
Form3 newMDIChild = new Form3();
newMDIChild.MdiParent = this;
//newMDIChild.WindowState = FormWindowState.Maximized;
newMDIChild.Show();
}
}
}
结果就是Form3也被最大化了