Microsoft Office Tutorials and References
In Depth Information
Simulating a Toolbar with a UserForm
Figure 15-16: A UserForm set up to function as a toolbar.
The VBA code takes care of the cosmetic details. It aligns the controls and adjusts the size of the
UserForm to eliminate wasted space. In addition, the code uses Windows API functions to make
the UserForm’s title bar smaller — just like a real toolbar. To make the UserForm look even more
like a toolbar, I also set the ControlTipText property of each Image control — which displays
a very toolbar-like tooltip when the mouse is hovered over the control.
Figure 15-17: The UserForm that simulates a toolbar.
If you open the file on the CD-ROM, you’ll also notice that the images change slightly when the
mouse is hovered over them. That’s because each Image control has an associated MouseMove
event handler that changes the SpecialEffect property. Here’s the MouseMove event
handler procedure for Image1 (the others are identical):
 
Search JabSto ::




Custom Search