toolstripDropDownButton

toolstripDropDownButton

本文介绍了如何关注toolstripDropDownButton。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有toolStrip Control,它有几个像toolstripButton,ToolStripDropDown按钮的项目。

对于ToolStripDropDownButton我没有创建任何dropDown列表,而是我使用的contextmenu只有很少的项目。

每当mouseHover到这个toolstripdropdownbutton我都会显示这个contextmenu。

这里是示例代码

  private   void  toolStripDropDownButtonOpen_MouseHover( object  sender,EventArgs e)
{
ToolStripDropDownButton btnSender =(ToolStripDropDownButton)sender;
Point ptLowerRight = new Point(btnSender.Bounds.Right - 95 ,btnSender.Bounds。底部+ 16 );
ptLowerRight = PointToScreen(ptLowerRight);
contextMenuStrip.Show(ptLowerRight);

}



我希望每当我关注toolStripButtonDropDown时,应关闭此contextMenu。我已经使用了mouseleave事件,但它无法正常工作。

任何帮助都将不胜感激。

感谢先进的

解决方案

I have toolStrip Control, and it has few items like toolstripButton, ToolStripDropDown button.
For ToolStripDropDownButton i am not creating any dropDown list, instead i am using contextmenu with few items.
Whenever mouseHover to this toolstripdropdownbutton i show this contextmenu.
here is sample code

private void toolStripDropDownButtonOpen_MouseHover(object sender, EventArgs e)
{
    ToolStripDropDownButton btnSender = (ToolStripDropDownButton)sender;
        Point ptLowerRight = new Point(btnSender.Bounds.Right - 95, btnSender.Bounds.Bottom + 16);
        ptLowerRight = PointToScreen(ptLowerRight);
        contextMenuStrip.Show(ptLowerRight);           
        
}


I want whenever i loose focus on toolStripButtonDropDown that time this contextMenu should be closed. I have used mouseleave event for this but its not working properly.
Any help will be appreciated.
Thanks in advanced

解决方案

这篇关于如何关注toolstripDropDownButton。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 22:28