Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 6, 1997



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Support The Full ImageList API In VB4

To draw a selected transparent image in VB4 from an Imagelist control, as you do in C++, follow these steps. The ImageList_ API functions have many features that weren't passed through in the control. In order to support the full API, the ImageList control exposes the property hImageList, which returns a handle you can use when calling the API functions. In the ListImage.Draw method, you can specify imlNormal, imlTransparent, imlSelected, or imlFocus. In the underlying API ImageList_Draw function, however, these are bit flags, and there is an additional flag to draw a mask. This function draws an image from an image list with any combination of draw flags:
 Sub DrawImage(img As ImageList, vIndex As Variant, _
	hDC As Long, x As Long, y As Long, _
	Optional vDraw As Variant)

	If IsMissing(vDraw) Then _

	ImageList_Draw img.hImageList, _
		img.ListImages(vIndex).Index - 1, hDC, _
		x / Screen.TwipsPerPixelX, _
		y / Screen.TwipsPerPixelY, vDraw
End Sub
These functions are documented on the MSDN. Take a look. You may find many other uses for them.
A. Nicklas
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date