Please enable JavaScript to view this site.

A-Shell Reference

Static image controls are created with XCALL AUI_CONTROL, with ctype set to MBF_STATIC + MBF_BITMAP (plus optional flags such as MBF_NODISTORT, MBF_CENTER, MBF_KBD, etc.) For example:

xcall AUI, AUI_CONTROL, CTLOP_ADD, NUL_CTLID, imgfile$, MBST_ENABLE, ctype, NUL_CMD$, NUL_FUNC$, NUL_CSTATUS, srow, scol, erow, ecol, NUL_FGC, NUL_BGC, NUL_FONTATTR, NUL_FONTSCALE, NUL_FONTFACE$, NUL_TOOLTIP$, parentid$, NUL_WINCLASS$, winstyle

Here are a few examples, using the above code with different values for ctype, winstyle, and the coordinates. In each case, we draw a groupbox just outside the image control so that you can easily see the true size of the control (which doesn't always match the size of the image).

Stretched to fit, no border

ctype = MBF_STATIC + MBF_BITMAP

winstyle = 0

ashref_img152

No distortion, thick frame border

ctype = MBF_STATIC + MBF_BITMAP + MBF_NODISTORT

winstyle = WS_THICKFRAME    ! &h0004000 (border)

ashref_img153

The WS_THICKFRAME flag puts a border around the static control, making it look more like a button. (You can make it act like a button, in the sense of giving it a click event, by adding the MBF_KBD flag and specifying a click string in the cmd parameter.)

When the MBF_NODISTORT flag is used, the image is scaled only as much as it can be without changing the aspect ratio. So if the original static control shape is relatively taller or wider than the image shape, you end up with extra vertical or horizontal space within the control. The question then becomes how to position the image within the space provided, the default being as shown above, in the upper left. You can use the MBF_HCENTER, MBF_VCENTER or MBF_CENTER flags to force horizontal and/or vertical alignment, as in the example below:

ctype = MBF_STATIC + MBF_BITMAP + MBF_NODISTORT + MBF_CENTER   ! H+V centering

winstyle = WS_THICKFRAME    ! &h0004000 (border)

ashref_img154

By default, after computing the maximum image size and position of the scaled image, the static control is then shrunk to fit. This probably makes no difference unless the border option is used, but to see the effect of not shrinking the control to fit the image, add the SS_CENTERIMAGE flag, as shown below:

ctype = MBF_STATIC + MBF_BITMAP + MBF_NODISTORT + MBF_CENTER

winstyle =  WS_THICKFRAME + SS_CENTERIMAGE  ! &h0004000 + &h00000200

ashref_img155

See the program STIMGT in EXLIB:[908,32] for illustrations of many of these static image alignment options.