There are two ways to implement the menu function:
First:Send a key to the applicationProgram.
First, focus on the current active RichTextBox, and then send a shortcut command to implement the operation function.
Richtextbox1.focus (); sendkeys. send ("^ A"); // select all sendkeys. send ("^ C"); // copy sendkeys. send ("^ X"); // cut sendkeys. send ("^ V"); // Paste
Method 2: using commands to operate the clipboard
// copy the clipboard. setdata (dataformats. RTF, richtextbox1.selectedrtf); // copy the RTF data to the clipboard // cut the clipboard. setdata (dataformats. RTF, richtextbox1.selectedrtf); // copy the RTF data to the clipboard richtextbox1.selectedrtf = ""; // then clear the currently selected RTF content. The cut function is now enabled. // paste richtextbox1.paste (); // paste the data on the clipboard to the target RichTextBox // select all (both methods are available) richtextbox1.focus (); // set the focus to locate the RichTextBox of the current activity first. This sentence is very important, otherwise it cannot be correctly executed // the other one is through select (INT start, int length) method To implement richtextbox1.select (0, richtextbox1.rtf. length); // richtextbox1.rtf. length indicates the length of the text in RichTextBox // One is to directly select all using the selectall () method provided in the Net Framework // richtextbox1.selectall ();