Introduction

Now you can use Davide Calabro's excellent CButtonSt class in your ATL/WTL projects. The Class is still called CButtonSt and it retains a majority of the original code. Just follow these simple instructions:

Create a WTL Project

Design the dialog and add the button controls

Add the ButtonST.h header file to your project

Assign a CButtonSt to each button.

In OnInitDialog,

Subclass each member controls (CButtonST) to each ID using the SubclassWindow method.

uses the CButtonSt methods to change the appearance of the control.

In your dialog, don't forget to add the macro REFLECT_NOTIFICATIONS which allows the buttons to get messages like WM_DRAWITEM.

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.

Comments and Discussions

Great article! I'm finding this class immensely useful in my project. One suggestion: would be cool to add custom fonts to the buttons. I see in DrawItem you're just doing DrawText ... so should be pretty simple to add. (I can do it, but ... oh, so lazy.

I don't know if this has to do with the button class or the dialog but I was able to get the sample program to lockup by clicking on the "Click and hold pressed" button. I believe I clicked the button and held down the mouse, draged away and then released the button to get it to lockup.