开发者

C# bring form to front in Windows 7 ThumbnailToolBarButton's click event

开发者 https://www.devze.com 2023-01-28 01:50 出处:网络
I\'ve made an ThumbnailToolBarButton and I want to bring the form to front whwn i click the button. I`ve tried this:

I've made an ThumbnailToolBarButton and I want to bring the form to front whwn i click the button. I`ve tried this:

this.TopMost = true;
this.Focus();
this.BringToFront();
this.TopMost = false;

in the button click event but the form appear and when i`ve move the mouse away from the thumbnail the form disappear. 开发者_开发知识库How can i make the form remain in front with topmost = false?


using System.Runtime.InteropServices;  
...  
namespace N  
{  
   class C {  
     [DllImport("User32.dll")]  
     public static extern Int32 SetForegroundWindow(int hWnd);  
     ...  
     void f(){  
          SetForegroundWindow(this.Handle.ToInt32());  
     }  
  }  

}

0

精彩评论

暂无评论...
验证码 换一张
取 消