C#SendKeys.Send [英] C# SendKeys.Send
问题描述
我正在使用C#SendKeys.Send方法的问题上运行。我想,以取代与其他键的键盘按键,比如当我按下A键盘我想那个键是S,例如,当我在我的代码做这个:
I am running on an issue using C# SendKeys.Send method. I am trying to replace keyboard keys with other keys, for example when I press "a" in keyboard I want that key to be "s" for example, when I am doing this in my code:
if ((Keys)keyCode== Keys.A)
{
SendKeys.Send("s");
}
现在,我得到的只有sa的字符印刷我记事本,但不是印刷SA我需要的,因为当我按下是我的键盘上的一,必须以S代替,只得到S字符在这种情况下。
Right now I get only "sa" character printed in my notepad, but instead of printing "sa" I need to get only "s" character in this case because when I press "a" on my keyboard, "a" must be replaced with "s".
我试图加入这一行删除最后一个字符:
I tried removing the last character by adding this line:
SendKeys.Send("{BS}");
但是,所有我得到的是S字删除,一字在那里。
But all I got is "s" character removed and "a" character was there.
我怎样才能防止这种情况发生?
How can I prevent this from happening?
推荐答案
我解决了这个问题,通过全球注册热键。谢谢。
这是国土资源的我用来解决我的问题。
I solved this problem by registering global hot keys. Thank you. This was the resourse that I used to solve my problem.
这篇关于C#SendKeys.Send的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!