如何模拟使用C#CTRL + V键击(粘贴) [英] How simulate CTRL+V keystrokes (paste) using C#

查看:255
本文介绍了如何模拟使用C#CTRL + V键击(粘贴)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们怎样才能模拟<大骨节病> 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆