SET_BCX_BITMAP statement

Purpose: SET_BCX_BITMAP complements the BCX_BITMAP function by allowing the bitmap image of a BCX_BITMAP control to be changed after the control has been created.


 Syntax:

 SET_BCX_BITMAP(hBitmapDest, _
                  BitmapFile$ _
                     [, Res%] _
                   [, Width%] _
                  [, Height%])

 Parameters:

  • hBitmapDest is a HWND handle to the control, created by BCX_BITMAP, onto which the bitmap is to be set.
  • BitmapFile$ specifies the file containing the bitmap which is to be placed on the control. The BitmapFile$ parameter is set to "" if the bitmap is to be retrieved from a resource.
  • Res% [OPTIONAL] parameter containing an integer value to a bitmap resource. Res% is used if the bitmap is to be retrieved from a resource.
  • Width% [OPTIONAL] parameter containing an integer value specifying the width to which the bitmap is to be set.
  • Height% [OPTIONAL] parameter containing an integer value specifying the height to which the bitmap is to be set.

Remarks: The SET_BCX_BITMAP statement has been written so that either a file based bitmap or a resource based bitmap can be passed to the procedure. The default setting for the optional parameter Res% is 0 which means that the bitmap will be retrieved from the file specified in BitmapFile$. If the bitmap is to be retrieved from a resource then the integer value of the resource handle is passed in Res% and 0 is used as a parameter value for BitmapFile$. The sample below illustrates this inside the EVENTS loop.


  $RESOURCE "$PELLES$\bin\porc.exe"
  
  $COMPILER "$PELLES$\Bin\pocc -W1 -Gd -Go -Ze -Zx -Tx86-coff $FILE$.c"

  $LINKER "$PELLES$\Bin\polink _
                      -release _
                 -machine:ix86 _
            -subsystem:windows _
               -OUT:$FILE$.exe _
                    $FILE$.obj "
  
  BCX_RESOURCE 123 BITMAP two.bmp
 
  GUI  "BCX_Set_Bitmap"
 
  GLOBAL Form1 AS CONTROL
  GLOBAL Bmp1  AS CONTROL
  GLOBAL Butt1 AS CONTROL
 
  SUB FORMLOAD
   Form1 = BCX_FORM("Set_Bitmap", 0, 0, 100, 130)
   Bmp1 = BCX_BITMAP("one.bmp", Form1, 0, 10, 30, 0, 0)
   Butt1 = BCX_BUTTON("Change", Form1, 12345, 15, 10, 0, 0)
   CENTER(Form1)
   SHOW (Form1)
  END SUB
 
  BEGIN EVENTS
   STATIC Toggle
   IF CBCTL = 12345 THEN
     Toggle = NOT Toggle
     SELECT CASE Toggle
       CASE TRUE
       SET_BCX_BITMAP(Bmp1, 0, 123) ' Load A Resource Based Bitmap
       CASE FALSE
       SET_BCX_BITMAP(Bmp1, "one.bmp") ' Load A File Based Bitmap
     END SELECT
   END IF
  END EVENTS