Using system;using system.collections.generic;using system.drawing;using system.windows.forms;using System.IO; namespace test{///<summary>///Description of mainform.///</summary>public partial class Mainform:form{pu Blic mainform () {////the InitializeComponent () call was required for Windows Forms designer Support.//initializecomponent ( );////Todo:add Constructor code after the InitializeComponent () call.//}void Button1Click (object sender, EventArgs e) {RI Chtextbox1.focus (); Richtextbox1.select (0, richTextBox1.Rtf.Length);} void Button2click (object sender, EventArgs e) {clipboard.setdata (dataformats.rtf, richtextbox1.selectedrtf);//}void Button4click (object sender, EventArgs e) {clipboard.setdata (dataformats.rtf, richtextbox1.selectedrtf);// Copy the RTF data to the Clipboard richtextbox1.selectedrtf= "";//delete the currently selected RTF content, the current cut function.} void Button3click (object sender, EventArgs e) {richtextbox1.focus (); Richtextbox1.paste ();//}void Button5click (object sender, EventArgs e) {FileStream fs=new FileSTREAM ("F:\\ppp.rtf", FileMode.Create, FileAccess.Write); Richtextbox1.savefile (FS, Richtextboxstreamtype.richtext); fs. Close ();}}}
Example of using RichTextBox in C # to achieve picture-and-text blending and preservation