[RESOLVED] put 1 image in picturebox without need the image file
i sod some visual basic 6 projects that use pictures but without using the image file....
how can i put 1 image in picturebox and transport the project to another pc without an image file?
thanks
Re: put 1 image in picturebox without need the image file
you could put in a resource file and not need it in a folder
http://support.microsoft.com/kb/q194409/
Call it like this:
Set picture1.Picture = LoadPictureResource(101, "Custom")
if it's a bmp
picture1.Picture = LoadResPicture(113, vbResBitmap)
Re: put 1 image in picturebox without need the image file
The answer: Resource Files. Do you know how to use them?
Tutorial: http://www.thevbzone.com/l_res.htm
Read that over and pay attention to where LoadResPicture is used/discussed.
isnoend07 got there first ;)
Re: put 1 image in picturebox without need the image file
There's info about resource files in my signature, but there's also inbuilt "resource file"s where you have the image hard-coded as data in the EXE file, you don't even need to have the file then. The way you do this is to set up a picturebox on your form, and set it as hidden, and set the image at DESIGN time rather than in code, that way it's automatically set from the start. You can copy the image to another picturebox if required, in code, and it's a good way to make use of an image that is regularly used :-)
Re: put 1 image in picturebox without need the image file
Try using a JPG that is embedded into the project itself. However lots of these will make the program slow down, chop, and then maybe crash. Also it will make your file size, greatly increase. Thats why I said, to use a JPG instead of anything else.
1 Attachment(s)
Re: put 1 image in picturebox without need the image file
see these project(isn't my project)...
these project don't use resources files.... but thanks for the tutorial... it's great!!!
embedded?? what is it? how can i use it?
thanks
Re: put 1 image in picturebox without need the image file
Well it the file(s) show up in the project explorer, instead of windows explorer. But I only know how to do that on Access 97 and not VB6!! But it isn't code, it is clicking with the mouse only. That part I know about.
Try looking on the Internet, about embedded media files in VB6 or try MSDN on the MS website. (Some where on it!!)
Re: put 1 image in picturebox without need the image file
I have just consulted my superiors.
You use the Project > Add File Menu or "Ctrl + D". And then fiddle with the controls there, and then you are able to deal with embedding media objects into it. But that is usually used for internal data files, eg: TMP, DB and etc.
Re: put 1 image in picturebox without need the image file
Quote:
Originally Posted by ThEiMp
I have just consulted my superiors.
You use the Project > Add File Menu or "Ctrl + D". And then fiddle with the controls there, and then you are able to deal with embedding media objects into it. But that is usually used for internal data files, eg: TMP, DB and etc.
i tested know that.... but i sod 1 thing.... don't put image files, but the pictureboxs has the images....
how is these possivel(i'm sorry these word is right write?(i'm portuguese))?
thanks
Re: put 1 image in picturebox without need the image file
I already suggested how to do it :-P
Put a picturebox on your form, and set the image of it to the image you want at DESIGN time...this makes it a part of the project from the start, and when you compile it the image is then stored in the file. Hide the picturebox but give it a name you can reference later and just copy from that picturebox to the picturebox you want :-)
Re: put 1 image in picturebox without need the image file
Quote:
Originally Posted by smUX
I already suggested how to do it :-P
Put a picturebox on your form, and set the image of it to the image you want at DESIGN time...this makes it a part of the project from the start, and when you compile it the image is then stored in the file. Hide the picturebox but give it a name you can reference later and just copy from that picturebox to the picturebox you want :-)
i'm sorry... yes you have right...
what i did was:
-put the image in picturebox.
-build the *.exe file.
-change the image file name(for test it).
-then i execute the file and works fine...
thank you very much....
thanks
Re: [RESOLVED] put 1 image in picturebox without need the image file
Now hide the picturebox, so it isn't displayed at runtime :-)
Re: [RESOLVED] put 1 image in picturebox without need the image file
Quote:
Originally Posted by smUX
Now hide the picturebox, so it isn't displayed at runtime :-)
yes :)...
thanks for help me
Re: [RESOLVED] put 1 image in picturebox without need the image file
joaquim, if you are saving many images this way, recommend using an ImageList or Resource File instead. Why? For many images, you will have many pictureboxes, no? And dozens of pictureboxes use far more system resources in your application than are necessary, potentially making your app a system resource hog.
Re: [RESOLVED] put 1 image in picturebox without need the image file
Quote:
Originally Posted by LaVolpe
joaquim, if you are saving many images this way, recommend using an ImageList or Resource File instead. Why? For many images, you will have many pictureboxes, no? And dozens of pictureboxes use far more system resources in your application than are necessary, potentially making your app a system resource hog.
thanks for advice my friend...