问题
I've been bored, so I tried to make a program that writes a Look of Disapproval smiley(the ಠ_ಠ face) when pressing ctrl+shift+L. Now everything works, except for the underscore that is in the smiley, which won't get written at all.
This was what I used first:
SendKeys.Send("ಠ_ಠ");
I've tried various things, like adding {} brackets around the underscore, and of course I googled this too.
Is there any way I can get the underscore to get sent?
Thanks in advance.
回答1:
Mixing different encodings creates weird result. ಠ is Unicode, _
is ASCII. Different length characters confuse and iritate Visual Studio.
Try:
SendKeys.Send("\u0CA0_\u0CA0");
Or:
SendKeys.Send("\u0CA0\u005F\u0CA0");
回答2:
If you don't use an english keyboard layout that has the underscore as key you can't just type the ASCII character but have to write it as a combination of modifier and character keys.
来源:https://stackoverflow.com/questions/8217373/unable-to-send-underscore-with-sendkeys-in-c