简体   繁体   English

C#WPF eckbox转换为键盘

[英]C# WPF ckeckbox to keyboard

I have a check box in my window, I want when the user clicks it works as if the user clicks on the ALT key on keyboard. 我的窗口中有一个复选框,我希望当用户单击它时就像用户单击键盘上的ALT键一样。 How can I do this? 我怎样才能做到这一点?

I can think of three mechanisms which you could leverage. 我可以想到三种可以利用的机制。

1) Raise the KeyDown event for your control manually. 1)手动引发控件的KeyDown事件。

2) Perhaps look into the SendKeys class. 2)也许看一下SendKeys类。

3) Or you could P/Invoke to SendInput . 3)或者您可以P / Invoke到SendInput

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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