本文介绍了双击时,如何将所选单词复制到剪贴板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的代码在这里:
my Code is here:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Xml;
using MouseKeyboardActivityMonitor.WinApi;
using MouseKeyboardActivityMonitor;
namespace dictionar_demo_1
{
public partial class MainForm : Form
{
private readonly KeyboardHookListener m_KeyboardHookManager;
private readonly MouseHookListener m_MouseHookManager;
public MainForm()
{
InitializeComponent();
m_KeyboardHookManager = new KeyboardHookListener(new GlobalHooker());
m_KeyboardHookManager.Enabled = true;
m_MouseHookManager = new MouseHookListener(new GlobalHooker());
m_MouseHookManager.Enabled = true;
m_KeyboardHookManager.KeyPress += HookManager_KeyPress;
}
private void HookManager_KeyPress(object sender, KeyPressEventArgs e)
{
string x = string.Format("{0}", e.KeyChar);
if (x == "f")
{
m_MouseHookManager.MouseDoubleClick += HookManager_MouseDoubleClick;
}
}
private void HookManager_MouseDoubleClick(object sender, MouseEventArgs e)
{
Clipboard.Clear();
// i want to copy the selected text
//from any document(like pdf, .html ,txt)
// when i double-click a text
}
}//form
}
现在该怎么办。
我试过很多方法我没有做到这一点。
Now what should i do.
I tried in many ways i failed to do that.
推荐答案
这篇关于双击时,如何将所选单词复制到剪贴板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!