【发布时间】:2021-03-05 22:02:52
【问题描述】:
我想编写一个简单的应用程序,从字符串中获取一个单词,然后按下该字符串中每个字母对应的键,以写入该单词,例如在记事本上。
到目前为止我得到的是:
public void TestKeyboard()
{
string a = "test"; //this is the string it should be written
foreach (char c in a)
{
Keyboard.KeyPress(c); //how to obtain this? this isn't working
}
}
如何获得 Keyboard.KeyPress 事件?
【问题讨论】:
-
这能回答你的问题吗? Simulating Key Press c#
-
@MathewHD 它没有回答我的问题。我想做的是从字符串中读取一个单词,然后使用按键逐个字母地“键入”该单词。
标签: c# string keyboard keypress