开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜