2011-03-16 41 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