Upravit

Sdílet prostřednictvím


Using Rich Edit Controls

This section contains topics that demonstrate how to create and use rich edit controls.

In this section

Topic Description
How to Create Rich Edit Controls
To create a rich edit control, call the CreateWindowEx function, specifying the rich edit window class. For Microsoft Rich Edit 4.1 (Msftedit.dll), specify MSFTEDIT_CLASS as the window class. For all previous versions, specify RICHEDIT_CLASS. For more information, see Versions of Rich Edit.
Rich edit controls support most of the window styles used with edit controls as well as additional styles. You should specify the ES_MULTILINE window style if you want to allow more than one line of text in the control. For more information, see Rich Edit Control Styles.
How to Format Text in Rich Edit Controls
An application can send messages to a rich edit control in order to format characters and paragraphs and retrieve formatting information. Paragraph formatting attributes include alignment, tabs, indents, numbering, and simple tables. For characters, you can specify font name, size, color, and effects such as bold, italic, and protected.
How to Interact with the Current Selection
The user can select text in a rich edit control by using the mouse or the keyboard. The current selection is the range of selected characters, or the position of the insertion point if no characters are selected. An application can get information about the current selection, set it, determine when it changes, and show or hide the selection highlight.
How to Use Rich Edit Text Operations
An application can send messages to retrieve or find text in a rich edit control. You can retrieve either the selected text or a specified range of text.
How to Use Word and Line Break Information
A rich edit control calls a function called a word-break procedure to find breaks between words and to determine where it can break lines. The control uses this information when performing word-wrap operations and when processing CTRL+LEFT ARROW key and CTRL+RIGHT ARROW key combinations. An application can send messages to a rich edit control to replace the default word-break procedure, to retrieve word-break information, and to determine what line a given character falls on.
How to Use Rich Edit Clipboard Operations
An application can paste the contents of the clipboard into a rich edit control by 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.
How to Use Streams
You can use streams to transfer data into or out of a rich edit control. A stream is defined by an EDITSTREAM structure, which specifies a buffer and an application-defined callback function.
How to Automatically Resize Rich Edit Controls
An application can resize a rich edit control as needed so that it is always the same size as its contents. A rich edit control supports this so-called bottomless functionality by sending its parent window an EN_REQUESTRESIZE notification code whenever the size of the control's content changes.
How to Use Rich Edit Control Notification Codes
A rich edit control's parent window can process notification codes to monitor events that affect the control. Rich edit controls support all of the notification codes that are used with edit controls, as well as several additional ones.
How to Use Font Binding in Rich Edit Controls
Microsoft Rich Edit 3.0 assigns a character set to plain-text characters depending on their context. Some examples are:
  • Greek characters are assigned GREEK_CHARSET.
  • Hangul symbols are assigned HANGUL_CHARSET.
  • Chinese characters are assigned SHIFTJIS_CHARSET if kana characters are found nearby, or GB2312_CHARSET if no kana are found nearby.
  • Non-neutral ANSI characters are assigned ANSI_CHARSET in any event.
How to Use OLE in Rich Edit Controls
This section contains information about using object linking and embedding (OLE) in rich edit controls.
How to Print the Contents of Rich Edit Controls
This section contains information about how to print the contents of rich edit controls.