Bitmap Methods

The methods listed below deal with bitmaps.

ChangeBitmapButton

>>-aBaseDialog~ChangeBitmapButton(--id--,--bmpNormal----------------------->

>--+--------------------------------------------------------------------+-->
   +-,bmpFocused--+---------------------------------------------------+-+
                  +-,bmpSelected--+---------------------------------+-+
                                  +-,bmpDisabled--+---------------+-+
                                                  +-,styleOptions-+

>--)----------------------------------------------------------------------><


The ChangeBitmapButton method changes the bitmaps of a bitmap button.

Arguments:

The arguments are the same as for ConnectBitmapButton, except for the first argument (msgToRaise), which is skipped in this method.

Example:

The following example replaces the current bitmap with a new bitmap:

MyDialog~ChangeBitmapButton(501, "NewBB.bmp")

GetBitmapSizeX

>>-aBaseDialog~GetBitmapSizeX(--id--)-------------------------><


The GetBitmapSizeX method returns the horizontal bitmap extension.

Arguments:

The only argument is:

id

The ID of the bitmap button

GetBitmapSizeY

>>-aBaseDialog~GetBitmapSizeY(--id--)-------------------------><


The GetBitmapSizeY method returns the vertical bitmap extension.

Arguments:

The only argument is:

id

The ID of the bitmap button

DrawBitmap

>>-aBaseDialog~DrawBitmap(--+------+--,--id---------------------->
                            +-hwnd-+

>--+----------------------------------------------------------+-->
   +-,--px--,--py--+----------------------------------------+-+
                   +-,--srcx--,--srcy--+------------------+-+
                                       +-,--xlen--,--ylen-+

>--)------------------------------------------------------------><


The DrawBitmap method draws the bitmap of a button. You can also use this method to move a bitmap or a part of it.

Arguments:

The arguments are:

hwnd

The handle to the window. If this argument is omitted, the handle for the button is used automatically.

id

The ID of the button that has the owner-draw option set

px, py

The upper-left corner of the target space within the button (default is 0)

srcx, srcy

The upper-left corner within the bitmap (default is 0)

xlen, yLen

The extension of the bitmap or a part of it (default is the whole bitmap)

ScrollBitmapFromTo

>>-aBaseDialog~ScrollBitmapFromTo(--id--,--fromX--,--fromY--,--toX--,--toY--,-->

>--stepX--,--stepY--,--delay--,--displace--)------------------><


The ScrollBitmapFromTo method scrolls a bitmap from one position to another within an owner-drawn button.

Arguments:

The arguments are:

id

The ID of the button

fromX, fromY

The starting position

toX, toY

The target position

stepX, stepY

The width of one step

delay

The time in milliseconds this method waits after each move before doing the next move. This determines the speed at which the bitmap moves.

displace

If set to 1 the internal position of the bitmap (bitmap displacement) is updated after each incremental move. DisplaceBitmap is called after each step to adjust the bitmap position. If the dialog is redrawn, the bitmap is shown at the correct position, but the drawing is slower.

TiledBackgroundBitmap

>>-aBaseDialog~TiledBackgroundBitmap(--bmpFilename--)---------><


The TiledBackgroundBitmap method sets a bitmap as the background brush (Windows NT® only). If the bitmap size is less than the size of the background, the bitmap is drawn repetitively.

Arguments:

The only argument is:

bmpFilename

The name of a bitmap file

BackgroundBitmap

>>-aBaseDialog~BackgroundBitmap(--bmpFilename------------------->

>--+-------------+--)------------------------------------------><
   +-,--"USEPAL"-+


The BackgroundBitmap method sets a bitmap as the dialog's background picture.

Arguments:

The arguments are:

bmpFilename

The name of a bitmap file

option

Set the last argument to USEPAL if you want to use the color palette of the bitmap. See ConnectBitmapButton for more information.

DisplaceBitmap

>>-aBaseDialog~DisplaceBitmap(--id--,--x--,--y--)-------------><


The DisplaceBitmap method sets the position of a bitmap within a button.

Arguments:

The arguments are:

id

The ID of a button

x

The horizontal displacement in screen pixels. A negative value can be used.

y

The vertical displacement (negative allowed)

Example:

The following example moves the bitmap within a button four screen pixels to the right and three pixels upward:

MyBaseDialog~DisplaceBitmap(244, 4, -3)

GetBmpDisplacement

>>-aBaseDialog~GetBmpDisplacement(--id--)---------------------><


The GetBmpDisplacement method gets the position of a bitmap within a button.

Arguments:

The only argument is:

id

The ID of the button

Example:

The following example shows how to use the GetButtonRect and GetBmpDisplacement methods:

bRect = MyBaseDialog~GetButtonRect(244)
parse var bRect left top right bottom
bmpPos = MyBaseDialog~GetBmpDisplacement(244)
parse var bmpPos x y