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 AS STRING, _ hwndParent AS HWND, _ CtlID AS INTEGER, _ Xpos AS INTEGER, _ Ypos AS INTEGER, _ Width AS INTEGER, _ Height AS INTEGER _ [, Res AS INTEGER] _ [, WinStyle AS INTEGER] _ [, ExWinStyle AS INTEGER]) Return Value:
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 resource file as 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, 140, 115) BCX_SET_FORM_COLOR(Form1,QBCOLOR(15)) CENTER(Form1) SHOW(Form1) Bmp1 = BCX_OLEPICTURE("", Form1, 115, 15, 10, 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
Click here to download a .zip containing BCX_OLEPICTURE.jpg.
Extract it to the same directory as BCX_OLEPICTURE.bas.
Save the following snippet as build.bat, modifying the path as needed
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
Then run build.bat to build the BCX_OLEPICTURE.exe.
Remarks:
The default window Style for a BCX_OLEPICTURE control also can be changed by using the MODSTYLE function.