C # Implementation WinForm RichTextBox inserts a picture at a specified cursor location _c# tutorial

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.