Please enable JavaScript to view this site.

A-Shell Reference

Button image controls are nearly identical to static image controls. To create them, use the same code as you would for static image controls, but replace MBF_STATIC with MBF_BUTTON, and the eliminate WS_THICKFRAME flag and any SS_xxx flags from the winstyle parameter. (Buttons always have borders, which makes them look very similar to the static controls with the WS_THICKFRAME option.)

Another subtle difference is that buttons are not by default shrunk to fit the non-distorted scaled image, unless one of the MBF_CENTER, MBF_HCENTER, or MBF_VCENTER flags is used. Plus, the default alignment is centered. For example:

ctype = MBF_BUTTON + MBF_BITMAP + MBF_NODISTORT

ashref_img156

In the above example, the images are centered in the button. The image is not stretched to fit the button because of the MBF_NODISTORT flag, and the button is not subsequently shrunk to fit the image because none of the alignment flags were used. If we add MBF_CENTER to the above, we get the following:

ctype = MBF_BUTTON + MBF_BITMAP + MBF_NODISTORT + MBF_CENTER

ashref_img157

Note that in the above case, the effect is virtually identical to the corresponding static control.

See the routine TSTICB in SOSLIB [907,23] for an example of using intermixing icons and other image types on buttons.