XPButton: Office XP Style Button

Category:
Forms and Controls
Type:
Controls
Difficulty:
Advanced
Author:
Roman Bobik

Version Compatibility: Visual Basic 6

More information:
The XPButton control mimics an Office XP/2002 style button. That means it determines the background-color dynamically between the standard-background-color and the selected-text-color.

There are many other advanced features:

  • Standard-, hover- and pressed-picture
  • Caption with selectable font and color
  • Horizontal and vertical alignment for text and picture (can be different)
  • Selectable background-color and hover-color (standard-hover-color and office XP-hover color is the color of selected text)
  • Unique states such as pressed and not enabled
  • Some minor properties to let the control fit your needs
  • Keyboard-accelerator support
The control exposes all needed events such as Click, DblClick, MouseDown, MouseUp, MouseMove, MouseEnter, MouseLeave, ...

It runs on Windows 95/98/ME/NT4/2000/XP. For use with Windows 95 there is a special compatibility-mode (because Windows 95 doesn't support mouse leave events).

All methods, properties & events are described inline. There is a dependency on vbAccelarator's subclass library, which must be registered using regsvr32.


Instructions: Click the link below to download the code. Select 'Save' from the IE popup dialog. Once downloaded, open the .zip file from your local drive using WinZip or a comparable program to view the contents.

Download xpbutton.zip