Structure defining location and behavior of images
Image support is universal among SRP OLE Controls. OLE Controls can load many image formats including BMP, ICO, PNG, JPG, GIF, PSD, Metafiles, and many others. When using images, there are generally three parts to the puzzle, though certain controls don't use all parts. These three elements are Image Path, Transparent Color, and Frame Count.
Image Path
The first part is the most obvious and necessary: image path. The image path is a full or relative path including the file name containing the image. All OLE Controls can load images from any of three sources: image files, DLL/EXE modules, or zip files.
Loading an image from a file is straightforward. Simply specify the path and filename:
// Load a bitmap Set_Property(@Window:".OLE_CTRL", "OLE.Image", "c:\image.bmp") // Load an icon Set_Property(@Window:".OLE_CTRL", "OLE.Image", "c:\logo.ico")
To load an image from a DLL/EXE resource, specify a path and filename for the target resource's .dll or .exe file followed by the pound sign (#) and the resource Id:
// Load resource #1001 from an .exe Set_Property(@Window:".OLE_CTRL", "OLE.Image", "c:\example.exe#1001") " Load resource MAIL_ICON from a .dll Set_Property(@Window:".OLE_CTRL", "OLE.Image", "c:\images.dll#MAIL_ICON")
To load an image from a zip file, specify a path and filename for the target .zip file followed by the pound sign (#) and the zipped file name:
" Load a PNG from the zip file Set_Property(@Window:".OLE_CTRL", "OLE.Image", "c:\images.zip#image.png")
Transparent Color
This transparent color allows the developer to specify that a certain color in the image list not be drawn. This allows bitmap images to appear as natural irregular shapes rather than as rectangles. transparent colors can be set to "Auto", "None", or to a specific color.
The easiest way to make a color transparent is to set this value to Auto. In so doing, the edit table will always use the image's top left pixel, the pixel located at coordinate (0, 0), to determine the transparent color. If you want a different color to be transparent, then pass an exact RGB color value. You can do this using OI's RGB function. If you don't any transparency, then set this value to None.
// set a 2 frame image list with pure blue as the transparent color Set_Property(@Window:".OLE_CTRL", "OLE.TransparentColor", RGB(0, 0, 255))
Some image formats embed transparency information within themselves, in which case the Transparent Color is ignored. PNG, ICO, and GIF files are some examples.
Frame Count
The frame count divides the image list into equal sized frames based solely on the image's width. For instance, if you set the image to a 100x50 pixel bitmap and the frame count to 2, then each frame is 50x50 pixels. Set the frame count to 10, and each frame will be 10x50 pixels. Setting this value to anything less than 1 is the same as setting it to 1.
Not all controls use a FrameCount. Refer to the individual control properties for more information.