JamJam
02-14-2005, 02:29 AM
Im trying to use ImageList_Draw to draw a image as transparent however im
not sure if im doing what im doing correctly. I currently have a form with a
imagelist called ImageList1 with one image of index 1 and picturebox called
picture1.Image.
The main problem is i have seen lots of written code but i have not really
found any tutorials explaining what things mean so im trying to experiement
and find out for myself. The following code executes but nothing appears in
the picture box. I guess im doing stuff wrong so an explaination of what
will work will help.
My code is as follows
Const ILD_TRANSPARENT = &H1
Private Declare Function ImageList_Draw Lib "comctl32.dll" (ByVal himl&,
ByVal i&, ByVal hDCDest&, ByVal X&, ByVal Y&, ByVal Flags&) As Long
Private Sub Command2_Click()
Dim hImg As Long
Dim r As Long
hImg = ImageList1.hImageList
r& = ImageList_Draw(hImg, 1, Picture1.hdc, 0, 0, ILD_TRANSPARENT)
Picture1.Picture = Picture1.Image
End Sub
So why doesnt the above code work?
Any comments will be really helpfull
Jamie
not sure if im doing what im doing correctly. I currently have a form with a
imagelist called ImageList1 with one image of index 1 and picturebox called
picture1.Image.
The main problem is i have seen lots of written code but i have not really
found any tutorials explaining what things mean so im trying to experiement
and find out for myself. The following code executes but nothing appears in
the picture box. I guess im doing stuff wrong so an explaination of what
will work will help.
My code is as follows
Const ILD_TRANSPARENT = &H1
Private Declare Function ImageList_Draw Lib "comctl32.dll" (ByVal himl&,
ByVal i&, ByVal hDCDest&, ByVal X&, ByVal Y&, ByVal Flags&) As Long
Private Sub Command2_Click()
Dim hImg As Long
Dim r As Long
hImg = ImageList1.hImageList
r& = ImageList_Draw(hImg, 1, Picture1.hdc, 0, 0, ILD_TRANSPARENT)
Picture1.Picture = Picture1.Image
End Sub
So why doesnt the above code work?
Any comments will be really helpfull
Jamie