|
-
Aug 17th, 2000, 05:47 PM
#1
Thread Starter
Hyperactive Member
Hi,
I know that I can store Bitmaps, Cursors and Icons in a resource files. Can I also store .JPG files?
If not, how can I store 5 .JPG files in my app without first assinging them to 5 image controls and show/hide them?
Thanks.
-
Aug 17th, 2000, 05:56 PM
#2
Put them in a RES file, but instead of loading them as a Bitmap, load them as a Custom resource.
-
Aug 17th, 2000, 06:00 PM
#3
Thread Starter
Hyperactive Member
Thanks Megatron,
How do I do that? The following doesn't work...
imgBackImg.Picture = LoadResPicture(1, CUSTOM)
Should I replace 'CUSTOM' with something else?
Thanks.
-
Aug 17th, 2000, 08:37 PM
#4
Here you go:
Code:
Public Sub RunPictureFromResource(pintResourceID As Integer, pPictureBox As PictureBox)
Dim bytArr() As Byte
Dim intFFN As Integer
Dim strPath As String
bytArr = LoadResData(pintResourceID, "CUSTOM")
strPath = App.Path & IIf(Right(App.Path, 1) = "\", MyPicture.tmp", "\MyPicture.tmp")
intFFN = FreeFile
Open strPath For Binary As intFFN
Put #intFFN, , bytArr
Close #intFFN
pPictureBox = LoadPicture(strPath)
Kill strPath
End Sub
Then call this function like this:
Call RunPictureFromResource(101, Picture1)
Where
101 - is a resource ID
Picture1 - is a name of the PictureBox
[Edited by Serge on 08-17-2000 at 09:39 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
|