[DllImport("user32.dll", EntryPoint = "SetParent")]
public static extern int SetParent(int hWndChild, int hWndNewParent);
[DllImport("user32.dll", EntryPoint = "FindWindow")]
public static extern int FindWindow(string lpClassName, string lpWindowName);
public Form1()
{
InitializeComponent();
SetParent(this.Handle.ToInt32(), FindWindow("Progman", "Program Manager"));
}
public static extern int SetParent(int hWndChild, int hWndNewParent);
[DllImport("user32.dll", EntryPoint = "FindWindow")]
public static extern int FindWindow(string lpClassName, string lpWindowName);
public Form1()
{
InitializeComponent();
SetParent(this.Handle.ToInt32(), FindWindow("Progman", "Program Manager"));
}
这样做的目的在于将窗体的父窗口设为桌面,那么就不会被最小化了