A simple question :) how do I insert icons into a richtextbox.
For example I want " :-) " to be replaced by, say, ImageList[1] ?
Thanks!
I think only way is using Paste option.
Try this code
    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();
    }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With