Icons in a rich text box?

A simple question :) how to embed icons in richtextbox.

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

Thanks!

+4
source share
2 answers

I think that only the option uses the Insert 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(); } } 
+1
source

Source: https://habr.com/ru/post/1343904/


All Articles