固定使用user32.dll中USER32的ShowWindow .NET
public partial class Form1 : Form
{
TheForm theForm;//empty form
public Form1()
{
InitializeComponent();
theForm = new TheForm();
}
internal const int SWP_SHOWWINDOW = 0x0040;
[DllImport("user32.dll", CharSet = CharSet.Auto)]
internal static extern int ShowWindow(IntPtr hWnd, short cmdShow);
private void button1_Click(object sender, EventArgs e)//shows theForm when it wants to
{
ShowWindow(theForm.Handle, SWP_SHOWWINDOW);
}
private void button2_Click(object sender, EventArgs e)//shows theForm always
{
theForm.Show();
}
}
爲什麼叫USER32的ShowWindow後,大部分時間窗口 「停留在地獄」 第三方控件? 它捕獲焦點丟失和丟棄,但不捕獲鼠標事件,也不會自行繪製。
你想要做什麼在上帝的綠色地球上? – siride
試圖修復第三方組件... –