|
-
Jan 25th, 2009, 03:39 PM
#1
Thread Starter
Lively Member
picture BOX LOAD .PNG PROB
i had try all picture its load easy in picture box
but png file wont load there
picture1.picture=loadpicture(app.path & "\picname.png")
wont load there
i dont know wuts prob
if someone know help plss
i need to load png picture
thanks in adv
i had some png viewr but i dont understand code
there is simple away to loaD??
-
Jan 25th, 2009, 03:48 PM
#2
Re: picture BOX LOAD .PNG PROB
VB does not support PNG files, so you need to write your own code (or use somebody elses) that will load them and convert them to a format that VB can understand.
If you look at the help for LoadPicture, you will see this explanation:
Graphics formats recognized by Visual Basic include bitmap (.bmp) files, icon (.ico) files, cursor (.cur) files, run-length encoded (.rle) files, metafile (.wmf) files, enhanced metafiles (.emf), GIF (.gif) files, and JPEG (.jpg) files.
As is often the case, you can find pre-written (and well tested) examples in our CodeBank - VB6 forum, in this case I think the best is this one:
AlphaImage Control - PNG Compatible [VB6] (by LaVolpe)
-
Jan 25th, 2009, 03:53 PM
#3
Re: picture BOX LOAD .PNG PROB
Unfortunately, VB does not support the PNG format. You cannot load a PNG file with only VB controls.
There are at least 2 solutions that come to mind
1. Use GDI+ which can load a PNG and draw it to the picturebox's DC. There are examples on this site
2. Use a 3rd party usercontrol that will do it for you. Not that I am promoting my project, but I did create a couple that you can use. Here are links to those if you'd like to play with them.
A scaled down version that supports only PNGs and animated PNGs also
A larger version that supports many different image formats
Edited: SI_The_Geek beat me to the reason. And thanks for the reference to my project
-
Jul 12th, 2009, 04:40 PM
#4
Member
Re: picture BOX LOAD .PNG PROB
LaVolpe your links dont work and i was interested in seeing the scaled down version
-
Jul 12th, 2009, 04:56 PM
#5
Re: picture BOX LOAD .PNG PROB
 Originally Posted by dmach8
LaVolpe your links dont work and i was interested in seeing the scaled down version
Sorry about that, those posts/projects have been pulled for personal reasons. You may find copies of the controls out on the net (search for LaVolpe Alpha Image), but other than that I am not giving that code away any longer.
P.S. Those links were for a pretty advanced usercontrol, you don't need something that advanced if all you want to do is draw pngs to a form or picturebox. GDI+ will do that and there are plenty of examples on this forum and elsewhere.
Last edited by LaVolpe; Jul 12th, 2009 at 05:01 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|