Windows requires a click to activate a window before a second click will select a button. How can I change this?

后端 未结 4 1691
一向
一向 2021-02-13 03:26

My application is a C# Windows Forms Application and .Net somehow makes the default behavior of my main menu bar and tool strip buttons to be that you have to first click on my

4条回答
  •  被撕碎了的回忆
    2021-02-13 04:08

    You can detect the click on your form even when the application doesn't have focus if you subscribe for the MouseClick event.

    Then, when you click your form, you'll get the callback whether the form previously had focus or not.

    Then you can simulate the click on the control that you want.

    This isn't a terribly elegant solution, but it should work. You do have to make sure that the click doesn't get sent to your toolbar button twice.

提交回复
热议问题