<!-- Download Links -->
Download source files - 28 Kb
Download demo project - 136 Kb
<!-- Article image -->
<!-- Main HTML starts here -->
The code submitted contains 3 main owner drawn controls that work with WTL.
Along with a sample of a property sheet that can be embedded in a dialog and
an add-in class that makes it easy to add tool tips to all of the controls
in a dialog. They are all pretty straightforward to use and the demo program
details how to work with them.
Text Button Class
There is a Text Button class that allows you to specify custom colors for and
attach a menu to it. When you attach a menu to it a small arrow will be drawn at
the end of it.
Make sure that you include
in any owners message map or the button will not be able to process the proper
One problem I have with the control is when it is transparent. Transparent controls
by nature need the owner to paint the background behind them. I have not found a way to
have the parent do this.
In order to use the button you need to make the following calls
Btn.SetBorderColors(crDark, crDkShadow, crLight);
Color Label Class
There is a color label class that allows labels to change the foreground
color and will draw it transparently. You can also set the Font Name and Point
Size along with Bold, Italic, Underline, and PointSize of the label.
In order to use the label you need to make the following calls
m_Label1.SetText("Label 1", false);
Owner Drawn Tab Control
There is a also an owner drawn tab control that will allow colors to be set
for the background, the selected tab, the unselected tab, and the text. You can
also set a font, point size, and if it is bold.
In order to use the Tab
you need to make the following calls
m_Tab.SetColors(crDark, crLight, crBack, crText, true);
Property Sheet Class that can be embedded in a dialog
This class shows has a property sheet can be embedded in a dialog.
To create the sheet I do the following in the dialog that I want it in
HWND hWndPlaceHolder = GetDlgItem(IDC_PROP_SHEET_HOLDER);
m_Sheet.Create(m_hWnd, 0, rc);
Tool Tip Dialog
This is an add-in class that will load a resource string for each child window in
the dialog. The string that is loaded will be the same as the Control ID of the
child window. The only call necessary is
in the dialog that you want tool tips in. Then make sure that the stringtable
has items added that match the control id of the child windows
One thing to note. Static text controls, check boxes, and radio buttons must
all have the
style set from the dialog editor.
I hope you find these classes helpful.