Article ID: 138537
Article Last Modified on 7/1/2004
APPLIES TO
- Microsoft Visual Basic 4.0 Standard Edition
- Microsoft Visual Basic 4.0 Professional Edition
- Microsoft Visual Basic 4.0 32-Bit Enterprise Edition
This article was previously published under Q138537
SUMMARY
Visual Basic 4.0 introduces a new control called the ImageList control that holds an array of pictures or icons. Although this control is primarily used by other controls, such as the TreeView and Toolbar control, that require an image list control, it can be used to simply store pictures for your graphics methods. PaintPicture can be used with the image list control to paint a picture onto a picture box or form. The example in this article demonstrates how to use the image list control as a stand-alone image repository.
MORE INFORMATION
Step-by-Step Example
To create a new application that prints all of the pictures in an image list control to the form, follow these steps:
- Place a command button and image list control on a form.
- Load the image list control with several images.
Add the following code to the Click event of the command button:
Private Sub Command1_Click() Dim i As Integer AutoRedraw = True ScaleMode = vbPixels With ImageList1 For i = 1 To .ListImages.Count PaintPicture .ListImages(i).Picture, 0, i * .ImageHeight Next i End With End Sub
- Run the project, and click the command button.
Additional query words: kbVBp400 imagelist paintpicture listimages kbCtrl kbVBp kbDSupport kbdsd
Keywords: kbhowto KB138537