Results 1 to 15 of 15

Thread: [RESOLVED] put 1 image in picturebox without need the image file

  1. #1

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,964

    Resolved [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
    VB6 2D Sprite control

    To live is difficult, but we do it.

  2. #2
    PowerPoster isnoend07's Avatar
    Join Date
    Feb 2007
    Posts
    3,237

    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)
    Waiting for a full featured smart phone with out marrying a provider
    Go Android
    Go raiders

  3. #3
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  4. #4
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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 :-)
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  5. #5
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    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.
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  6. #6

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,964

    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
    Attached Files Attached Files
    Last edited by joaquim; Oct 19th, 2008 at 02:54 AM.
    VB6 2D Sprite control

    To live is difficult, but we do it.

  7. #7
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    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!!)
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  8. #8
    PowerPoster ThEiMp's Avatar
    Join Date
    Dec 2007
    Location
    Take The PCI Bus Across To The CPU!!
    Posts
    3,948

    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.
    I have a huge free products range, of computer software in which you can download using any kind of 64-Bit Web Browser. Also there is coming a Social Networking section that I am making on my Website...

    |Ambra Productions Inc. | The Black Sun Society | The Black Shield | Ambra College | Church of the Black Sun | Ambra Productions Inc's Homepage | Boomtick Venues: Ambar Nightclub, Jack Rabbit Slim's, Villa Nightclub and Lucy's Love Shack | Pasta Ambra | Fish Feast Company | Wallet Wizard | Ambrose Liquor | Ambar Tavern | Ambra University | Ambra Cheese |

    Do you wish to do unpaid work for me??? If so, the PM me on this Forum, and then we can get to work, programming for the future of computers go by the name of ThEiMp. This is my ghost writers name. Also my nickname, means that I am: The Imperial of the Technology Industry, so then to make it really short, I just then wrote: The Imp, which is where I get the nickname from...

  9. #9

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,964

    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
    VB6 2D Sprite control

    To live is difficult, but we do it.

  10. #10
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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 :-)
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  11. #11

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,964

    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
    VB6 2D Sprite control

    To live is difficult, but we do it.

  12. #12
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    Re: [RESOLVED] put 1 image in picturebox without need the image file

    Now hide the picturebox, so it isn't displayed at runtime :-)
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  13. #13

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,964

    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
    VB6 2D Sprite control

    To live is difficult, but we do it.

  14. #14
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    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.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  15. #15

    Thread Starter
    PowerPoster joaquim's Avatar
    Join Date
    Apr 2007
    Posts
    3,964

    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...
    VB6 2D Sprite control

    To live is difficult, but we do it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width