Download source files - 8 Kb
Download demo project - 37 Kb
CWBButton is a 'WindowBlinds' like resizable
image button derived from a CButton. In MFC, You can use the class called
that's not enough. The size of button is the size of the bitmap, and you can't put a text by calling the
SetWindowText(). I wanted REAL Bitmap Button like GTK+ or WindowBlinds. So I try to create
a REAL Bitmap Button referring WindowBlinds.
How to Use
Using CWBButton is simple.
- Add Files to your project.
WBButton.h, WBButton.cpp, AutoFont.h, AutoFont.cpp
- To the Dialog's header file:
- Create a button on your dialog, and make sure you turn on the "Owner Draw" property.
- Inside the Dialog class:
CButton m_btn1 to
- Initialize the
CWBButton in the event handler
as described below:
IDB_BITMAP1, 5, 15, 6, 15, 8 );
To initialize correctly, you know how to be implemented in the WindowBlinds. Each rectangle lead
by LeftWidth, RightWidth, TopHeight, and BottomHeight is static, and not stretched. The others are
stretched by the size of button. So you can get natural button images. It may be difficult to set
the parameters correctly, but you can refer the Initialize file of WindowBlinds, which name is
'*.uis', on the section '[Buttons]'.
- The bitmap you load should be separate at least four parts. The First is 'Normal' state, the
second is 'Select' state, the Third is 'Disable' state, and the fourth is 'Focus' state.
- To transparent the button, the bitmap background color should be RGB(255,0,255), also you can
change the transparent color by calling the function
I tested this source on the Japanese version VC6.0 and Windows. Problems may occur on other language