RichEdit Overlay (non-MFC)



The image shows the graphical output of the enclosed test application.

This snippet demonstrates how to make a RichEdit control transparent — so
that the text draws over top of the contents of the parent window (or even
a memory DC). Best of all, it should work all the way back to Win95 / NT 3.1
and only relies on the Win32 APIs.

The basic concept is to draw the contents of the control into a memory DC,
then use BitBlt() techniques (or TransparentBlt() if available) to generate
a mask and overlay the text directly over the target DC.

Obvious enhancements include preallocating the memory DC and mask, then
imaging the text only when it changes.

This code is hereby placed in the public domain.

Downloads

Download demo project – 51 Kb

Download source – 3 Kb

More by Author

Get the Free Newsletter!

Subscribe to Developer Insider for top news, trends & analysis

Must Read