blog

枪手亨利

博客园 首页 新随笔 联系 订阅 管理
 RichEdit Overlay (non-MFC)

http://www.codeguru.com/cpp/controls/richedit/article.php/c2391/
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

posted on 2005-12-29 16:48  henry  阅读(1186)  评论(0)    收藏  举报