The idea was simple, I needed to use simple hyperlink buttons in my application. I searched for them on the net and could not find any, so I decided to write down my own class of Hyperlink buttons.
CHButton is a
CButton derived class and its objects are simple buttons, with the user interface of a Hyperlink control. The only thing you'll have to do is to attach a cursor to it, which you can do using the function:
This class also has the following public methods:
HS_ALWAYS - Displays the underline always.
HS_HOVER - Displays the underline when the mouse is over the button.
HS_NONE - Removes the underline if exists.
void SetHoverTextColor(COLORREF clrTextColor,BOOL bShowColor =TRUE);
Sets the Hyperlink button text color when the mouse is over the button.
void SetTextColor(COLORREF clrColor)
Sets the text color of the Hyperlink button.
void SetIcon(HICON Icon)
Sets the specified icon to the button.
void SetToolTip(LPCSTR strText, BOOL bActive = TRUE);
Sets the ToolTip text for the Hyperlink button.
How to Use it
- Add "HButton.cpp" and "HButton.h" files to your project.
- In your dialog's header file, write:
- Create a button on your dialog and in the Properties tab set the "owner draw" property.
- Add a
m_btn variable to the just created button and in your dialog's header file rename it to
- Compile and enjoy it
- Version 1.3 (July 10, 2005)
- Version 1.2 (July 10, 2005)
- Added Hover Underline feature.
- Version 1.1 (July 08, 2005)
- Version 1.1 (July 06,2005)
- Version 1.00 (July 05, 2005)