devxlogo

Support The Full ImageList API In VB4

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 passedthrough in the control. In order to support the full API, the ImageListcontrol exposes the property hImageList, which returns a handle you canuse 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 amask. This function draws an image from an image list with any combinationof 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 _		vDraw = ILD_NORMAL Or ILD_TRANSPARENT	ImageList_Draw img.hImageList, _		img.ListImages(vIndex).Index - 1, hDC, _		x / Screen.TwipsPerPixelX, _		y / Screen.TwipsPerPixelY, vDrawEnd Sub

These functions are documented on the MSDN. Take a look. You may findmany other uses for them.

See also  How IoT Tech Will Transform Logistics
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist