ebmDevMag.com home
ebm Developer's Magazine
links

developer's mag
main page

article
part 1
part 2
part 3
part 4
part 5
part 6
part 7
part 8
part 9


3 - Image Buttons

To show image buttons at work, this column's example program demonstrates a custom image bitmap. Starting off as a CButton deposited on the form with the Form Editor, we change the bitmaps displayed when we initialize with the call SetImages(), passing it IMAGE pointers. The result can be seen in the demo, with a toggling ball in place of the usual button.

While interesting to use, some points should be kept in mind while programming with button images:
  • The images should all be the same size, to avoid edge issues when redrawing.
  • If you use white for a color, be aware that the button assumes that white is the transparency color, and will not overwrite with it - use a near-white color for areas you want erased on the previous image.
  • Image buttons are probably the only case you will want to adjust the last three parameters of the button constructor from the default. If you have a text caption on the image, the 'downoffset' parameter indicates how far down and to the right the caption is offset when the button is down, which you may or may not want to change.
  • Although it can be interesting to change buttons, making a UI item non-standard is a sure way to confuse users, and should be used cautiously.


Previous Section
Next Section

Copyright © 2001-2006 ebmDevMag.com - Legal Notice