我制作了一个ThumbnailToolBarButton,我想把表单放到前面,然后单击按钮。我试过这个:
this.TopMost = true;
this.Focus();
this.BringToFront();
this.TopMost = false;
在按钮单击事件中,但表单出现,当我将鼠标从缩略图移开时,表单消失。如何使表格保持在最前面= false?
答案 0 :(得分:0)
using System.Runtime.InteropServices;
...
namespace N
{
class C {
[DllImport("User32.dll")]
public static extern Int32 SetForegroundWindow(int hWnd);
...
void f(){
SetForegroundWindow(this.Handle.ToInt32());
}
}
}