BCX_OLEPICTURE function
Purpose: BCX_OLEPICTURE loads and displays a BMP, GIF, JPG, WMF, EMF, or ICO image from a file or resource.
Syntax: hCtl = BCX_OLEPICTURE(BitmapFile$, _ hWndParent, _ CtlID%, _ Xpos%, _ Ypos%, _ Width%, _ Height%, _ [,Res%] _ [,WinStyle%] _ [,ExWinStyle%]) Parameters:
|
Remarks:
When BCX_OLEPICTURE
is invoked,
the BCX_OLE_WIDTH
and
BCX_OLE_HEIGHT
macros are defined.
These macros allow the retrieval of the width and the height of
the control containing the image loaded by the
BCX_OLEPICTURE
function.
ImageWidth% = BCX_OLE_WIDTH(hCtl) ImageHeight% = BCX_OLE_HEIGHT(hCtl)
Example: The example below loads an image from a resource file.
Save the following as the resource file BCX_OLEPICTURE.rc.
500 RCDATA "BCX_OLEPICTURE.jpg"
Save the following as BCX_OLEPICTURE.bas.
GUI "BCX_OLEPICTURE" SUB FORMLOAD GLOBAL Form1 AS HWND GLOBAL Bmp1 AS CONTROL Form1 = BCX_FORM("BCX_OLEPICTURE", 0, 0, 110, 110) BCX_SET_FORM_COLOR(Form1,QBCOLOR(15)) CENTER(Form1) SHOW(Form1) Bmp1 = BCX_OLEPICTURE("", Form1, 115, 2, 35, 0, 0, 500) END SUB BEGIN EVENTS SELECT CASE CBMSG CASE WM_CLOSE IF MSGBOX("Are you sure?", "Quit Program!", MB_YESNO) = IDYES THEN DestroyWindow(Form1) END IF EXIT FUNCTION END SELECT END EVENTS
Save the following image as BCX_OLEPICTURE.jpg by
Save the following and run as build BCX_OLEPICTURE.bat.
C:\dev\BCX\bin\bc.exe BCX_OLEPICTURE C:\dev\PellesC\bin\porc BCX_OLEPICTURE.rc C:\dev\PellesC\bin\pocc -W1 -Gd -Go -Ze -Zx -Tx86-coff BCX_OLEPICTURE.c C:\dev\PellesC\bin\polink -release -machine:ix86 -subsystem:windows -OUT:BCX_OLEPICTURE.exe BCX_OLEPICTURE.obj BCX_OLEPICTURE.res
Remarks: The default window Style for a BCX_OLEPICTURE control also can be changed by using the MODSTYLE function.