Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Can I convert Button to owner drawn style at runtime? Collapse All
Subject Author Date
Chris Anderson Apr 19, 2007 - 6:54 PM

Hi,
I have crated a standard button using CExtButton. At runtime, I need to change the style to BS_OWNERDRAW. I am using SetWindowLongPtr(hWnd, GWL_STYLE, lStyle ). After this change I am expecting WM_DRAWITEM to receive. But this is not hapening. Any issue in doing this? Please suggest.

Thanks

Chris Anderson Apr 30, 2007 - 3:01 PM

Thanks. I will try using this method

Chris Anderson Apr 26, 2007 - 10:22 AM

Please provide your feedback. I am waiting for your response.

Thanks

Technical Support Apr 27, 2007 - 9:01 AM

Actually as we said earlier the CExtButton has BS_OWNERDRAW applied by default and you won’t be able to handle WM_DRAWITEM. But instead you can perform any custom painting in the CExtButton::_RenderImpl() virtual method. Please let us know if you tried this method.

Chris Anderson Apr 20, 2007 - 12:09 PM

We are using CreateWindow() to create the normal button and then subclassed using CExtButton. After the button is shown, then user could change the style to BS_OWNERDRAW using SetWindowLongPtr(). In this scenario, does CExtButton will have BS_OWNERDRAW after subclassing?

Technical Support Apr 20, 2007 - 9:21 AM

The CExtButton has BS_OWNERDRAW applied by default. If you need to repaint the button in some specific way, you can override the CExtButton::_RenderImpl() virtual method.