你说的是mdi 父窗体 子窗体吧 把父窗体属性 isMdiContainer 选择trueusing System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;namespace WindowsFormsApplication9 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { Form2 newMDIChild = new Form2(); newMDIChild.MdiParent = this; newMDIChild.Show(); } } }
把父窗体属性 isMdiContainer 选择trueusing System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;namespace WindowsFormsApplication9
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form2 newMDIChild = new Form2();
newMDIChild.MdiParent = this;
newMDIChild.Show(); }
}
}
不如设置form1.topmost属性为ture,form2.topmost属性为false
和
MDI
show()
topmost也不行..一个ture一个false,打开其他程序时候会把两个窗体分开
最后决定用mdi,不过mdi子窗体总会被主窗体控件挡住...