怎么把WinForm窗体总是前置在所有应用程序之前
请教各位如何把WinForm窗体总是前置在所有应用程序之前
个人觉得TopMost 是在所有窗体中前置,而不是在应用程序中前置,所以没效果!
求解决办法
------解决方案--------------------
用WIn32吧
- C# code
private void FrmLogin_Activated(object sender, EventArgs e) { //获取或设置一个值,指示该窗体是否显示为最顶层窗体 this.TopMost = true; }
个人觉得TopMost 是在所有窗体中前置,而不是在应用程序中前置,所以没效果!
求解决办法
------解决方案--------------------
用WIn32吧
- C# code
[DllImport("USER32.DLL")] public static extern bool SetForegroundWindow(IntPtr hWnd); //把程序显示在最前方 SetForegroundWindow((IntPtr)Convert.ToInt32(ipuser.ToString()));