|
-
Aug 29th, 2012, 12:42 AM
#1
Thread Starter
Member
How to use resource file
I just learned that using a resource file is the way to go if you want to use bmp pictures in your project (among other file types).
I see a ton of info on how to load a file from a resource file, but Nothing about how to add a bmp (for instance) to the resource file.
I have a resource file added called "Resource1". I see it in the project explorer.
What is the procedure to add "C:\Temp\Mypicture.bmp" to my resource file and what would be the code to load it onto a picture box
named "Picture1" on a form named "MyForm" when clicking a command button?
If I can see this procedure, I can figure all the rest out.
Thanks
-
Aug 29th, 2012, 05:24 AM
#2
Re: How to use resource file
Double Click the Resource file in the Project Explorer Window. This will open the VB Resource Editor. Look at the Menu Icons; the third from the right is 'Insert Bitmap', click on that and navigate to the file to add.
The VB Resource Editor will add the Bitmap and an ID (eg 101- which you will use to load it later)
Save the Resource file
In your program:
Code:
Picture1.Picture = LoadResPicture(101, vbResBitmap)
-
Aug 30th, 2012, 07:53 AM
#3
Frenzied Member
Re: How to use resource file
you can try the following way . by default you will not get resource editor . when you click standard.exe .just got to Add in Manager and choose vb6 Resourc Editor.and finally click on Load Behavior frame .Loaded/Unloaded .
Code:
Picture1.Picture = LoadResPicture(101, vbResBitmap)
other alternate way to load same picture .using Inbuild function LoadPicture()
Code:
Picture1.Picture = LoadPicture("C:\Pic1.bmp")
Last edited by firoz.raj; Aug 30th, 2012 at 08:12 AM.
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
|