子窗口被覆蓋的效果圖如下:
後來hululuzhu網友給出了一個答案,我試了一下,是正確的,代碼如下
using System.Runtime.InteropServices;
[DllImport("user32")]
public static extern int SetParent(int hWndChild, int hWndNewParent);
//價格temp2是你的子form
temp2.MdiParent = this;
temp2.Show();
SetParent((int)temp2.Handle, (int)this.Handle);