devjeetroy
devjeetroy

Reputation: 1945

Is it possible to highlight text in a Win32 edit control?

I am working on a Win32 program in which I load text files. Would it be possible to highlight a particular word that is being displayed in the edit box?

By highlight, I mean, something like changing the color of the text as in syntax highlighting.

Upvotes: 3

Views: 2770

Answers (2)

Joe McGrath
Joe McGrath

Reputation: 1501

The Iczelion tutorial shows an alternative way to EM_SETCHARFORMAT that seems more like what you are asking. There are a few other ones. It was more common back when computers were slower, but just-in-time highlighting is the way to go.

Upvotes: 2

Remy Lebeau
Remy Lebeau

Reputation: 597051

A standard Edit control does not support that. Use a RichEdit control instead. It supports applying font/color settings to a range of characters via the EM_SETCHARFORMAT message.

Upvotes: 5

Related Questions