Important: The information in this document is obsolete and should not be used for new development.
Determining the Caret Position, and Selecting and Highlighting Text
To mark an insertion point you need to know where to draw the caret. To highlight text, you need to know the caret positions that begin and end the text range. This section describes routines that you use to locate a caret position for marking an insertion point or highlighting text. You can also use thePixelToChar
function to determine where to break a line, and theCharToPixel
function to find the screen pixel width of a text segment.
- The
PixelToChar
function converts a pixel location associated with a glyph in a range of text to a byte offset within the style run.- The
CharToPixe
l function converts a byte offset to a pixel location. The pixel location is measured from the left edge of the style run.- The
HiliteText
procedure returns three pairs of offsets marking the endpoints of ranges of text to be highlighted.
Subtopics
- PixelToChar
- CharToPixel
- HiliteText