Creates an Ocx ImageList control in the current active form, window, or dialog.
Ocx ImageList name [= text$] [, id] [, x, y, b, h] [, style%]
text$:control text
id%:control identifier
x, y, b, h:iexp
style%:the control styles
An ImageList control contains a collection of images of the same type and size, referred to by its index. The ImageList control is not meant to be used alone, but as a central repository to conveniently supply other controls with images. Specifically, the ListView, TreeView, TabStrip, and Toolbar controls use an ImageList control to store their images.
The ImageList control uses bitmap (.bmp, .dib), cursor (.cur), icon (.ico), JPEG (.jpg), metafiles (.emf, .wmf), or GIF (.gif) files in a ListImages collection of ListImage items. You can add and remove images at design time or run time.
The properties of the ImageList control define the size and type of the images added to the ListImages collection. The ImageHeight, ImageWidth, and ColorFormat properties set the dimensions of each image, the type of the image list, and whether to create a masked bitmap for the images. These properties are set before hand, either at design time in the 'ImageList Data' dialog box or in code. At design time the ColorFormat combo box forces to select a color format in combination with a mask.
A non-masked image list consists of a color bitmap that contains one or more images. A masked image list consists of two bitmaps of equal size. The first is a color bitmap that contains the images, and the second is a monochrome bitmap that contains a series of masks-one for each image in the first bitmap. When a non-masked image is drawn, it is simply copied into the target device context; that is, it is drawn over the existing background color of the device context. When a masked image is drawn, the bits of the image are combined with the bits of the mask, typically producing transparent areas in the bitmap where the background color of the target device context shows through.
The UseMaskColor property determines that for the next image a masked image is added to the list. You specify a color (MaskColor) that the system combines with the image bitmap to automatically generate the masks. Each pixel of the MaskColor color in the image bitmap is changed to black, and the corresponding bit in the mask is set to 1. As a result, any pixel in the image that matches the specified mask color is transparent when the image is drawn (using ListImage.Draw or ImageList.Overlay).
Images can be added one by one at design time and run time. GFA-BASIC 32 also supports the AddPart method that adds images from a larger bitmap strip to the ImageList control in one step.
BackColor | ColorFormat | Enabled | ImageHeight | ImageWidth | hImageList | Left | ListImage | ListImages | MaskColor | Name | Parent | Tag | Top | UseMaskColor
hImageList returns the handle to the underlying ImageList common control.
Add | AddItem | AddPart | Overlay
None
Local n As Int
OpenW 1, 30, 30, 300, 300
Cls colBtnFace
Ocx ImageList iml
iml.ImageWidth = 32
iml.ImageHeight = 32
iml.ColorFormat = 0
iml.MaskColor = colBtnFace
iml.UseMaskColor = True
iml.BackColor = colBtnFace
For n = 1 To 11 : iml.Add , "gfaicon" & n, CreatePicture(LoadIcon(_INSTANCE, n), False) : Next n
Ocx TreeView tv = "", 10, 10, 260, 240
tv.LineStyle = tvwRootLines : tv.ImageList = iml
For n = 1 To 11 : tv.AddItem , , , "GFA Icon" & n, "gfaicon" & n : Next n
Do : Sleep : Until Win_1 Is Nothing
The operating environment identifies an ImageList control in an application by assigning it a handle, or hImageList. Many ImageList-related API functions require the hImageList of the active window as an argument. Because the value of this property can change while a program is running, never store the hImageList value in a variable.
Animation, CheckBox, ComboBox, Command, CommDlg, Form, Frame, Image, Label, ListBox, ListView, MonthView, Option, ProgressBar, RichEdit, Scroll, Slider, StatusBar, TabStrip, TextBox, Timer, TrayIcon, TreeView, UpDown
{Created by Sjouke Hamstra; Last updated: 07/10/2017 by James Gaite}