如何模拟使用C#CTRL + V键击(粘贴) [英] How simulate CTRL+V keystrokes (paste) using C#
问题描述
我们怎样才能模拟<大骨节病> CTRL 骨节病> + <大骨节病> V 骨节病>键(粘贴)使用C#?
How can we simulate CTRL+V keys (paste) using C#?
我有未接入的ID的文本框,例如 textbox1.Text = someValue中
荣获'这里将不起作用。结果
我想通过点击它来填补文本框(剪贴板)。对于一些原因,我们需要准确地模拟<大骨节病> CTRL 骨节病> + <大骨节病> V 骨节病>,意味着我们不能使用外部库像的 inputsimulator 。
I have a textbox that hasn't a id for access, for example textbox1.Text = someValue
won't work here.
I want to fill that textbox (from clipboard) by clicking on it. For some reasons we exactly need simulate CTRL+V, mean we cannot use external libraries like inputsimulator.
推荐答案
焦点文本框,您要执行 CTRL + V
和发送该密钥^ {v}
例如
Focus the textBox, on which you want to perform ctrl+v
and send this key "^{v}"
For example
target_textBox.Focus();
SendKeys.Send("^{v}");
target_textBox.Focus();需要
只有当目标文本框没有聚焦于关键发送
target_textBox.Focus();
is needed only when target textbox is not focused at the time of sending key
这篇关于如何模拟使用C#CTRL + V键击(粘贴)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!