让窗体最前置的话,可以使用:
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool SetForegroundWindow(IntPtr hWnd);
这样调用:
SetForegroundWindow(this.Handle); //当前窗体是this
或者调用:
this.Activate(); //当前窗体是this
但是这两种方法都会激活窗体,且前者不能在最小化时使用。
如果使用:
this.TopMost=true;
this.TopMost=false;
的话,在下一次操作窗体之前,窗体都是最前的。
转载于:https://www.cnblogs.com/pengfeif/archive/2013/04/20/3032614.html