|
-
Jun 11th, 2000, 01:48 AM
#1
Thread Starter
Lively Member
is it possible to load a picture into a project, but not into an item(so a person wouldn't have to have the picture files AND the .exe just one big exe(i want to be able to change the picture of objects inside)?
-
Jun 11th, 2000, 01:58 AM
#2
PowerPoster
Res file
Just create a resource file (*.res) and copy all your graphics into it, then use the LoadResPicture function to load it at runtime.
Code:
Picture1.Picture = LoadResPictire(101,vbResBitmap)
-
Jun 11th, 2000, 04:15 AM
#3
Thread Starter
Lively Member
im still fairly new to vb....could you talk like i am 4?(no, i am not 4) how do i create the .res file, how do i copy graphics to it?(i figured out how to load graphics from a normal file, so i think i can fake the loading with what you gave me)
-
Jun 11th, 2000, 07:24 AM
#4
PowerPoster
Are you using VB6.0?
You need to load the Reasource File Editor at the begining when you load your VB IDE. This can be done with the following step:
- Goto Add-ins|Add-In Manager.
- Select the VB 6 Resource Editor.
- Check the Loaded/Unloaded CheckBox.
- Check the Load On Startup.
After this few step, you will be able to see the Resource Editor Icon in you toolbar.
Hence, To add image into the resource editor just do the following few step:
- Load the resource Editor.
- Add a new image by click on the Add bitmap icon.
- Select your desire bitmap image file, the editor will adutomatic assign a ID for the image (E.g. 101)
- Save the resource file in your project folder.
- Add the resource file into your project. Right Click your mouse in the Project Browser Window and chose Add|Add File. Just point to your resource file and click OK.
At this stage, all you need is to load the image by using the Picture1.Picture = LoadResPicture (101,vbResBitmap)
-
Jun 11th, 2000, 10:00 AM
#5
Addicted Member
Noo!
Use a res file but store the files in
JPEG. BITMAPS are too large.
Then use this code to retreive the
JPEG.
Code:
Public Sub LoadPic(Index As Integer)
Dim arrByte() As Byte
Dim IFFN As Integer
Dim strTempPath As String
arrByte = LoadResData(Index, "Custom")
strTempPath = App.path & "\Loading.jpg"
IFFN = FreeFile
Open strTempPath For Binary As IFFN
Put #IFFN, , arrByte
Close #IFFN
form1.picture1.Picture = LoadPicture(strTempPath)
Kill strTempPath
End Sub
-
Jun 11th, 2000, 10:02 AM
#6
Addicted Member
To show you how I did that..
VB will only accept a bitmap
so I converted the jpeg and
then saved it to the disk,
and loaded it..
If you have any problems with
that code mail me,
Or just reply.
-
Jun 11th, 2000, 10:12 AM
#7
Thread Starter
Lively Member
I am using VB6.0 and im using .gif (due to size mainly), is that a problem?
-
Jun 11th, 2000, 10:15 AM
#8
Addicted Member
Nope..
use the same code.
just load the picture as a custom
resource and then in a command button
put this
Loadpic 101
Then your need a picture box on the
form and the picture should load.
Tell be what happens.
-
Sep 13th, 2000, 07:05 AM
#9
Hyperactive Member
Is there any way I can use the resource editor to store jpeg files??????
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
|