简体   繁体   English

如何使用所有者绘制的丰富编辑控件

[英]How to use an owner drawn rich edit control

I'm using a Rich Edit Control on Windows. 我在Windows上使用Rich Edit控件。 I tried passing the value SS_OWNERDRAWN to the CreateWindowEx call but it appears to have had no effect. 我尝试将值SS_OWNERDRAWN传递给CreateWindowEx调用,但似乎没有任何效果。 How can I prevent the rich edit control from drawing anything so that I can owner draw it? 如何防止Rich Edit控件绘制任何内容,以便所有者可以绘制它?

I also attempted to set a window subclass that simply ignored WM_PAINT but forwarded all other messages. 我还尝试设置一个窗口子类,该子类仅忽略WM_PAINT而是转发所有其他消息。 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. 编辑:显然,即使您返回0并且不绘制任何内容,系统仍然期望BeginPaint和EndPaint响应WM_PAINT。 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. 我的系统不再消失,我的应用程序不再停止,并且丰富的编辑肯定不再画任何东西,但我仍然无法在该区域渲染Direct3D9文本。 :( :(

Edit: Turns out that, in fact, you do not have ownership of the DC returned by ID3DXFont::GetDC() . 编辑:事实证明,实际上,您没有ID3DXFont::GetDC()返回的DC的所有权。 Documentation unclear, but problem solved. 文档不明确,但问题已解决。

RichEdit controls do not support an owner-drawing window stye, so you cannot use SS_OWNERDRAWN or similar. RichEdit控件不支持所有者绘图窗口样式,因此不能使用SS_OWNERDRAWN或类似名称。

As for WM_PAINT , simply ignoring painting messages should not have caused such drastic side effects, so you must have done something else wrong. 至于WM_PAINT ,仅忽略绘画消息不应引起如此严重的副作用,因此您必须做其他错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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