Freetutes.com

VB6 beginners tutorial - Learn VB6

Advanced VB6 tutorial - Learn Advanced VB6

VB .NET - Learn Visual Basic .NET

Systems Analysis - System analysis and Design tutorial for Software Engineering


You are here: Visual Basic > Advanced VB6 tutorial > Chapter 4

Draw Method of ImageList Control in Visual Basic 6 (VB6)

You can use the Draw method of the ListImage object to draw an image on another object. As discussed earlier, an image from the ImageList control can be loaded into a PictureBox by setting the Picture property:

Picture1.Picture = ImageList1.ListImages(1).Picture

You can also use the Draw method to accomplish the same thing. With Draw, however, you have some additional options. The syntax for Draw is as follows:

ImageList1.ListImages(Index).Draw (HDC, x,y, style)

where Index identifies the image to be drawn. The Key value can be used in place of the Index as well. HDC is the device context ID of the destination device. If you were to draw an image onto a form, for example, you could specify Form1.HDC for the HDC property. This tells Windows where to put an image. The optional parameters, x and y, identify the coordinates within the destination at which the image will be drawn. The Style property can take one of the following four values:

  • imlNormal (0) The image will appear normally—with style = 1.
  • mlTransparent (1) The part of the image will appear to be transparent. Transparency is determined by the MaskColor property (set on the Color tab of the Custom Properties dialog box).
  • imlSelected (2) The image will be dithered with the system highlight color.
  • imlFocus (3) The image appears as if it has focus.

Related topics on ImageList Control


  

<< Previous | Contents | Next >>

Home | About Us | Privacy Policy | Contact Us

Copyright © Freetutes.com | All Rights Reserved