The example in this article describes how RichTextBox inserts a picture at a specified cursor position in the C # implementation WinForm. Share to everyone for your reference, specific as follows:
Gets the index position of the mouse focus in the RichTextBox control
int startposition = This.richTextBox1.SelectionStart;
Select a few characters starting from the mouse focus
this.richTextBox1.SelectionLength = 2;
Empty the Clipboard to prevent content
clipboard.clear ();
Set the picture object to
the Clipboard Bitmap bmp = new Bitmap (@ "Images\editredo.png");
Clipboard.setimage (BMP);
Paste the picture to the mouse focus position (the 2 characters will be overwritten by the picture because there are 2 characters selected)
richtextbox1.paste ();
Clipboard.clear ();
Read more about C # Interested readers can view the site topics: "C # Common control usage Tutorial", "C # Data structure and algorithm tutorial", "C # object-oriented Program design Introductory Course" and "C # Programming Thread Usage Skills Summary"
I hope this article will help you with C # programming.