Article ID: 166937 - Last Review: July 1, 2004 - Revision: 1.2 How To Programmatically Add Images to ImageList ControlThis article was previously published under Q166937 On This PageSUMMARY
This article describes how you can programmatically add images to the
ImageList ActiveX control.
MORE INFORMATION
An ImageList control contains a collection of ListImage objects, each of
which can be referred to by its index or key. The ImageList ActiveX control
acts as a central image repository to conveniently supply other controls
with images.
In order to add an image at run time, you need to use the Add Method of the ListImages collection. SyntaxThe Add method syntax has these parts:
Object.Add([Index,| Key,] Picture)
ExampleThe steps below demonstrate how to create an example of one of these controls:
You are not limited to any particular image size; however, the total number of images that can be loaded into ImageList ActiveX control is limited by the amount of available memory. At design time, you can add images using the Image tab of the ImageList Control Properties dialog box. To access this, right-click (secondary) on the ImageList control and select ImageListCtrl Properties from the shortcut menu. Omit step 5 above to have images added in this manner show on the tabs when the Command button is clicked. The code in step 6 above could be placed in the Init method of the form to have the SSTab control show the images when the form is loaded. REFERENCES
Custom Control Reference (Ctrlref.hlp in the Windows\System or
WinNT\System32 folder if using Visual FoxPro version 5.0)
Windows Common Controls help file (Comctl1.hlp in the Windows\System or WinNT\System32 folder if using version 5.0a). To access the Help file, right-click on the ImageList control on the form and select Help from the shortcut menu. In the ImageList Control topic, click See Also to jump to the ListImage Object, ListImages Collection topic. Select the Add Method (ListImages Collection) from the Methods jump. | Article Translations
|
Back to the top
