Fire Form KeyPress event

前端 未结 5 2257
生来不讨喜
生来不讨喜 2020-11-30 14:15

I have a C# winform, on which I have 1 button.
Now, when I run my application, the button gets focus automatically.

The problem is KeyPress event o

5条回答
  •  天命终不由人
    2020-11-30 14:54

    I would use one of the following:

    1. Set the TabIndex property of the button to 0.

    2. Set the IsDefault property of the button to true - So, It will be fired when pressing the ENTER key.

提交回复
热议问题