|1||VB 5 Custom Controls|| |
NOTE: this code has been superceded by the newer Flat Control DLL.
Flat Combo Boxes, Office 97 Style
The code also ensures that it correctly identifies when the mouse moves off the control by creating a temporary API timer in code. Timer events are responded to by subclassing the WM_TIMER message sent to the combo box's window handle.
How to Make Your Combo Boxes Flat
This is the easy bit!
There are two versions of this code. One is a private class module (15kb) which you can compile directly into your executable. The other is exactly the same class built into an ActiveX DLL (25kb). The reason for providing the DLL is to make it easier to debug code using this class. Because the class has to subclass the combo box's WM_PAINT message, when you break in VB's IDE many events can fire which make it difficult to debug (and, in the worst case, could cause a crash!). By using the DLL, you don't need to worry about these problems because all the subclassing code is isolated from your project. (And since the DLL is binary compatible, and supported, you can ship it with your project as well).
Start a new project, and add a combo box to the form. If you are using the DLL, add a reference to it (it will appear as "vbAccelerator Flat Combo Box Extender" in the references list. (Make sure you have registered vbalFCbo.dll and SSubTmr.Dll before doing this). Then you only need two lines of code:
' In the declarations section of the form:
Erm, and that's it. Hope you find it useful. Also, check out the
Creating Flat Combo Boxes in a Rebar sample.
Back to top
Back to Source Code