public class MyTextBox : System.Windows.Forms.TextBox
{
protected override void WndProc(ref Message m)
{
switch(m.Msg)
{
case 0x0302://WM_PASTE
//TODO:Add your code here
break;
default:
break;
}
base.WndProc(ref m);
}
}
然后把你的System.Windows.Forms.TextBox都换成 MyTextBox
{
protected override void WndProc(ref Message m)
{
switch(m.Msg)
{
case 0x0302://WM_PASTE
//TODO:Add your code here
break;
default:
break;
}
base.WndProc(ref m);
}
}
然后把你的System.Windows.Forms.TextBox都换成 MyTextBox
if(iData.GetDataPresent(DataFormats.Text)) {
string temp=(String)iData.GetData(DataFormats.Text);
//加入你的处理
//... textBox1.Text = (String)iData.GetData(DataFormats.Text);
}
else {
textBox1.Text = "Could not retrieve data off the clipboard.";
}