ToolStrip sometimes not responding to a mouse click

后端 未结 5 838
野的像风
野的像风 2020-12-06 17:49

I have a .NET 2.0 WinForms application with a ToolStrip on my main form. Sometimes, the ToolStrip icons don\'t respond to the first mouse click, so I have to click the icon

5条回答
  •  春和景丽
    2020-12-06 18:22

    I've had that in other dev environments (VB6), and it turned out to be because the first click was being absorbed by the toolbar to acquire the focus. Or, to put it another way, the toolbar wouldn't respond to a click until it had the focus. To test this, try clicking on an empty part of the toolbar before you click on the button. If you never have to click twice on the button after you've clicked on the toolbar then that might be the problem. I think they I got around it (and this was years ago, so please excuse the hack) was to programatically give the focus to the toolbar in the MouseOver event.

提交回复
热议问题