学渣
己所不欲,勿施于人
让窗体最前置的话,可以使用:
[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;
的话,在下一次操作窗体之前,窗体都是最前的。
posted on 2013-04-20 14:57  西米阿耶  阅读(1174)  评论(0编辑  收藏  举报