繁体   English   中英

C#将表单放在Windows 7 ThumbnailToolBarButton的click事件中

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

我做了一个ThumbnailToolBarButton,我想将表单带到前面,然后单击按钮。 我已经试过了:

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

在按钮单击事件中,但是表单出现,当我将鼠标从缩略图上移开时,表单消失。 我怎样才能使表格以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());  
     }  
  }  

}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM