Introduction

Here is an XP-style Button. It works on all windows OSs: 95/98/Me/NT/W2K/XP. No
subclassing etc is needed to use this control - it's just a plain simple button control. This code is
a modified
form of the OCX code I recently saw on codeguru. The button code was for an
ActiveX control. I created this CButton
derived class with latest Microsoft's sponsored CCP technology (Cut-Copy-Paste).

How to use it?

In you resource editor create a button and set the 'owner draw' property.

History

7 Aug 2002 - updated download

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

Rename the "CMemDC" , e.g. CMemDC1
I guess because there is already a class named "CMemDC" without the XPButton files .
If you add the XPButton files to the project , it says "redifinition" or something similar due to my compile result .

As was said before, when you use a non white color background, the round rectangle button drawn by this CXPButton class is stil visible in a non-rounded white rectangular frame...
Is there a way to handle that so that the frame is also rounded and XPstyle on such a different colored background?

The button is really nice, Appreciate you for that..
I am facing a small problem with this XP-style button, this works fine for any dialog, but when i add the event handler, InitDialog, the button looses the xp-style.
Please help...

The XP-style Button Control is fine, the problem is, only the Buttons show in XP-style, but what bout the other controls like the Edit box, List controls and other dialog box controls, they are still in the old style...

Can anyone tell me how to change the other controls to XP-style, so that the dialog box doesn't looks odd.

I found a little bug in this control; here's what I changed:
1) i did not want the BOLD font, so used another font, but that's personal...
2) if you use '&Ok' to underline the O of 'Ok', it works okay for disabled buttons, not for enabled. This code fixes that bug.