将cliboard粘贴到键盘所在的文本框中 [英] paste cliboard to textbox where keyboard is focused

查看:66
本文介绍了将cliboard粘贴到键盘所在的文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将cliboard粘贴到键盘所在的文本框中,请帮忙?

paste cliboard to textbox where keyboard is focused, please help?

推荐答案

假设这是winforms,或者C#无法访问用户剪贴板:

Assuming this is winforms, or C# has no access to the user clipboard anyway:
void myTimer_Tick(object sender, EventArgs e)
    {
    textBox1.Text = "";
    textBox2.Text = "";
    textBox3.Text = "";
    TextBox tb = ActiveControl as TextBox;
    if (tb != null)
        {
        tb.Text = Clipboard.GetText();
        }
    }

(显然,这不能通过按钮点击或任何其他控件来完成!)

(Obviously, this can''t be done from a button click or any other control!)


这篇关于将cliboard粘贴到键盘所在的文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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