Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Icons in rich text box?

A simple question :) how do I insert icons into a richtextbox.

For example I want " :-) " to be replaced by, say, ImageList[1] ?

Thanks!

like image 313
Roger Avatar asked Nov 06 '22 01:11

Roger


1 Answers

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();
    }
}
like image 56
Anuraj Avatar answered Nov 15 '22 05:11

Anuraj