Png not correct displaying using gdi+

01-05-2005, 06:25 PM
hi ppl!
I have a form and a modules in which i use gdi+ to load a nice 128x128 png image, iv used this image in programs like photoshop like corel or adove and i got always a good transparency of it.
when i load this png on my picturebox i get an image with black background and with a lot of pixels in white rounding the image! thats ugly! ive tried too resize it and the thumbnails thing but it still ugly.
the point its if somone knows what happen or wut i do wrong or ***!?i wanna get a nice 32bit transparency!if dont i must use a gif:(
Apreciated any help! thanks a lot!

01-05-2005, 07:44 PM
How exactly did you load it?

01-06-2005, 03:45 AM
Picture1.picture = LoadPicturePlus("-------.png")

I can get the image from png file but the result isnt satisfactory.
I'll add a screenshot if u tell me how lol :)

01-06-2005, 08:15 AM
The problem is that .Picture knows nothing of PNG transparency. You must use LoadFromFile and DrawImage in order to maintain transparency. I have an example posted here:

01-06-2005, 08:57 AM
He he. Lol i tried the gdi+4 and 6 and 7 and others but never 5!! lol thats the one which that helped me to understand the gdi+ at all! thanks its seems to be very much easier than i figured out!! :)
but a simple question... why this at the end ?

Private Sub Form_Unload(Cancel As Integer)
Set graphics = Nothing
Set bitmap = Nothing
End Sub

01-06-2005, 11:09 AM
Setting a class object equal to nothing destroys the instance and calls the Terminate event of the class. In the terminate event the GDI+ object (bitmaps, graphics, etc) is destroyed. If you did not set the class equal to nothing then they would not be destroyed and the memory would not be reclaimed. This would lead to memory leaks.

01-06-2005, 07:27 PM
huh! well that was more inportant than a simple question, i was near of open a lot of images without destroying the memory created!hmm... ur a good coderThanks :)

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum