using System.Runtime.InteropServices;
[DllImport("user32")]
public static extern int SetParent(int hWndChild, int hWndNewParent);
调用:
Form2 f2 = new Form2();
f2.MdiParent = this;
f2.Show();
SetParent((int)f2.Handle, (int)this.Handle);
上两位说的 TopMost 是错误的,题主自己试验即可。
上楼正解,设置窗体的属性TopMost为True,则该窗体将会置顶。
可是这个函数要怎么实现呀
设置窗体置顶TopMost