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());
}
}
}
精彩评论