Поделиться через


Clipboard Operations in Rich Edit Controls

Your application can paste the contents of the Clipboard into a rich edit control (CRichEditCtrl) using either the best available Clipboard format or a specific Clipboard format. You can also determine whether a rich edit control is capable of pasting a Clipboard format.

You can copy or cut the contents of the current selection by using the Copy or Cut member function. Similarly, you can paste the contents of the Clipboard into a rich edit control by using the Paste member function. The control pastes the first available format that it recognizes, which presumably is the most descriptive format.

To paste a specific Clipboard format, you can use the PasteSpecial member function. This function is useful for applications with a Paste Special command that enables the user to select the Clipboard format. You can use the CanPaste member function to determine whether a given format is recognized by the control.

You can also use CanPaste to determine whether any available Clipboard format is recognized by a rich edit control. This function is useful in the OnInitMenuPopup handler. An application might enable or gray its Paste command depending on whether the control can paste any available format.

Rich edit controls register two Clipboard formats: rich-text format and a format called RichEdit Text and Objects. An application can register these formats by using the RegisterClipboardFormat function, specifying the CF_RTF and CF_RETEXTOBJ values.

See Also

Reference

Using CRichEditCtrl

Concepts

Controls (MFC)