【问题标题】:How do I make somthing visible when the mouse moves across a button?当鼠标在按钮上移动时,如何使某些东西可见?
【发布时间】:2011-03-26 16:15:18
【问题描述】:

如何显示 PropertyGrid 而不是上下文菜单,这样当用户单击其他位置时,它会隐藏(就像上下文菜单一样)?

【问题讨论】:

    标签: c# winforms contextmenu mouseover propertygrid


    【解决方案1】:

    您可以将失去焦点与此操作联系起来。它并不完美(并非所有控件外的点击都会被捕获),但它会在每次另一个控件获得焦点时起作用。

    propertyGrid1.Leave += (object sender, EventArgs e) => { propertyGrid1.Hide(); };
    

    如果这还不够好,您可以尝试将操作关联到其他事件,例如表单的 Click 事件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-13
      • 2017-10-05
      • 1970-01-01
      • 2017-10-04
      • 2020-07-30
      相关资源
      最近更新 更多