简体   繁体   中英

.NET CF Don't trigger button-click on return

I have ac# .net cf 3.5 application on windows mobile 6.5

On a form there are several buttons with onclick-events .

How do I prevent the events from triggering, if they were sent by a return (on the software or hardware-keyboard) an not a "real" click?

Can I find out, which action sent the click-event?

There are three ways to prevent the Enter button to trigger Click.

  • Make a dummy/hidden button as the AcceptButton of the form. That way any Enter press would trigger that button instead.

  • Change the event handler to trigger on MouseUp or MouseDown instead

  • Subscribe to GotFocus event and set it to Focus on other control instead. That way it won't receive Enter event

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM