无法找到类型或命名空间名称'ClipboardEventArgs'
问题描述:
您好已经开始一个新的应用程序,我需要实现复制到剪贴板来检测用户有文本从文本框中复制我试图使用这个例子,但我得到这个错误:无法找到类型或命名空间名称'ClipboardEventArgs'
The type or namespace name 'ClipboardEventArgs' could not be found
这是一个类我用来做的伎俩,但它似乎我已经失败了一些东西。
我的课
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace OpenPop.TestApplication
{
public partial class ClipboardTextBox : TextBox
{
private const int WM_CUT = 0x0300;
private const int WM_COPY = 0x0301;
private const int WM_PASTE = 0x0302;
public delegate void ClipboardEventHandler(object sender, ClipboardEventArgs e);
[Category("Clipboard")]
public event ClipboardEventHandler CutText;
[Category("Clipboard")]
public event ClipboardEventHandler CopiedText;
[Category("Clipboard")]
public event ClipboardEventHandler PastedText;
public ClipboardTextBox()
{
InitializeComponent();
}
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_CUT)
{
if (CutText != null)
CutText(this, new ClipboardEventArgs(this.SelectedText));
}
else if (m.Msg == WM_COPY)
{
if (CopiedText != null)
CopiedText(this, new ClipboardEventArgs(this.SelectedText));
}
else if (m.Msg == WM_PASTE)
{
if (PastedText != null)
PastedText(this, new ClipboardEventArgs(Clipboard.GetText()));
}
base.WndProc(ref m);
}
}
}
}
答
好吧其实我解决了这个问题以不同的方式,所以我删除这个类和我有
private void button1_Click(object sender, EventArgs e)
{
Clipboard.SetText(messageTextBox.SelectedText);
MessageBox.Show("You Have Copy The Link The Message Will Bee Delete Now...");
deletemenssage();
}
更换所有该类你明白我的代码https://github.com/ispysoftware/iSpy/blob/master/Controls/ClipboardTextBox.cs,但你没有复制一切。如果你打算使用别人的代码,你应该引用原作者*,尤其是当原始软件需要许可证时。在这种情况下,iSpy是LGPL。 – Amy
艾米似乎有它的大小。一般来说,如果您在其他地方获得的代码存在问题,那么您应该说明您从哪里获得代码。通常情况下,这里似乎就是这种情况,通过抄录编辑后的高光部分可以删除上下文。一般来说,虽然艾米没有找到代码,我会问你认为'ClipboardEventArgs'应该是指什么 - 如果这是你写的代码,那么你必须知道它应该是什么... – Chris
没有在事实上我有从* –