简体   繁体   中英

How to use an owner drawn rich edit control

I'm using a Rich Edit Control on Windows. I tried passing the value SS_OWNERDRAWN to the CreateWindowEx call but it appears to have had no effect. How can I prevent the rich edit control from drawing anything so that I can owner draw it?

I also attempted to set a window subclass that simply ignored WM_PAINT but forwarded all other messages. This had an immensely nasty effect on my whole system and also caused my application to halt.

Edit: Apparently, the system still expects BeginPaint and EndPaint in response to WM_PAINT, even if you return 0 and don't paint anything. My system no longer dies and and my app no longer halts, and the rich edit is certainly no longer painting anything, but I still can't render my Direct3D9 text in that area. :(

Edit: Turns out that, in fact, you do not have ownership of the DC returned by ID3DXFont::GetDC() . Documentation unclear, but problem solved.

RichEdit controls do not support an owner-drawing window stye, so you cannot use SS_OWNERDRAWN or similar.

As for WM_PAINT , simply ignoring painting messages should not have caused such drastic side effects, so you must have done something else wrong.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM