2011-03-16 97 views

回答

1

我认为唯一的办法是使用粘贴选项。

试试这个代码

private void richTextBox1_KeyDown(object sender, KeyEventArgs e) 
{ 
    if (richTextBox1.Text.Contains(":-)")) 
    { 
     richTextBox1.SelectionStart = richTextBox1.Find(":-)", RichTextBoxFinds.WholeWord); 
     richTextBox1.SelectionLength = 3; 

     Clipboard.SetImage(im.Images["smile.png"]); 
     this.richTextBox1.Paste(); 
    } 
} 
+0

那会更换:-) – 2011-03-16 11:02:12

+0

@Gunner:我更新的代码。 – Anuraj 2011-03-16 11:09:32

+1

坏主意:它不修改用户的知识剪贴板。 – 2011-03-16 11:14:15