|
From: Jamie on 14 Feb 2005 04:04 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 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, &H1) Picture1.Picture = Picture1.Image End Sub Any comments will be really helpfull Jamie
From: Norm Cook on 14 Feb 2005 14:22 The Imagelist has Draw & ExtractIcon methods of its own so the ImageList_Draw call isn't required. For this code, the imagelist contains a single 16x16 icon Option Explicit Private Const ILD_TRANSPARENT As Long = &H1 Private Sub Form_Load() With Picture1 .AutoRedraw = True .BorderStyle = 0 .Appearance = 0 .Width = 16 * Screen.TwipsPerPixelX .Height = 16 * Screen.TwipsPerPixelY End With ImageList1.ListImages(1).Draw Picture1.hDC, 0, 0, ILD_TRANSPARENT End Sub "Jamie" <jammie][nospam][@pc-forums.net> wrote in message news:421068b6$0$2652$4c56ba96(a)master.news.zetnet.net... > 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 > > 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, &H1) > Picture1.Picture = Picture1.Image > End Sub > > Any comments will be really helpfull > Jamie > >
|
Pages: 1 Prev: XP chops the bottom of my VB6 forms Next: Canon SDK - Passing UDT ByRef |