# Button Image Control

> [HTML Version](buttonimagecontrol.htm)

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

(./images/ashref_img156.png)

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

(./images/ashref_img157.png)

Note that in the above case, the effect is virtually identical to the corresponding static control.

See the routine [TSTICB in SOSLIB \[907,23\]](https://bitbucket.org/microsabio/soslib/src/master/907023/tsticb.bas) for an example of using intermixing icons and other image types on buttons.