1

您好
,我想将 CTR + A 发送到其他应用程序以选择文本框中的所有文本,但我不知道如何同时发送 2 个键
我拆分所有键并一一
发送我使用的发送键:

System.Windows.Forms.SendKeys.Send(keys);

现在我如何同时发送 2 个键
或如何将 ctr + A 发送到其他应用程序以全选,我可以从 SendKeys 使用或有任何其他选项同时发送 ctr + A 或任何其他选项从另一个应用程序中选择所有文本?


谢谢。
亲切的问候,
山姆

4

3 回答 3

1

谢谢汉斯帕桑特

答:SendKeys 已经支持,请务必阅读 MSDN 文章。发送 Ctrl+A 只需要发送“^A”。^ 表示 Ctrl。

于 2013-10-15T16:32:00.563 回答
0

经历过这个。

唯一可行的解​​决方案:

找到要输入文本的元素

 element.SetFocus();

 Thread.Sleep(2000);

 SendKeys.SendWait("^{HOME}");  // Move to start of control

 SendKeys.SendWait("^+{END}"); // Select everything

 SendKeys.SendWait("{DEL}"); 

 SendKeys.SendWait("Value");
于 2018-10-05T06:57:12.617 回答
0

NumericUpDown控件的Enter事件中:

private void highlightNud_Event(object sender, EventArgs e)
{
    SendKeys.Send("^A");
}

这为我工作了很多很多年(flawlessley)。

于 2021-08-08T16:03:47.603 回答