|
-
Aug 30th, 2002, 09:09 AM
#1
Thread Starter
Lively Member
Slow program access
Hi, i have a program which when i click certain tabs, a new picture will be loaded. However, thess pictures are relatively large and whenever i load it, it would take about 2 -3 seconds on my 750Mhz system to show/toggle. This toggling of pictures is very frequent in my destinated usage.
Is there a way where i can load it and keep it in memory and thus no need to reload the picture which take a long time? Or is there a better alternative?
Pls advice, thanks in advance.
-
Aug 30th, 2002, 09:18 AM
#2
PowerPoster
I think if you put the pictures in a resource file, the'll stay in memory once you load them the first time
-
Aug 30th, 2002, 09:21 AM
#3
Thread Starter
Lively Member
Originally posted by phinds
I think if you put the pictures in a resource file, the'll stay in memory once you load them the first time
Sorry, but what do you mean by a resource file?
Can you elaborate?
-
Aug 30th, 2002, 09:23 AM
#4
A high level idea.
If you know in advance all the images that are going to be used
you could load them all when the program starts and use a
splash screen to cover the delay.
I don't know if the computers resources could handle it though.
-
Aug 30th, 2002, 09:30 AM
#5
Addicted Member
What about loading all pictures u use into Pictureboxes (not visible), and if u need the pics, blit them to the Picturebox that is visible for the user.
-
Aug 30th, 2002, 09:46 AM
#6
Thread Starter
Lively Member
Originally posted by Vegeta
What about loading all pictures u use into Pictureboxes (not visible), and if u need the pics, blit them to the Picturebox that is visible for the user.
Well, that would mean getting lots of picture boxes.
deadeyes, your idea is similar to Vegeta's, unless there's a better place to load it into.
-
Aug 30th, 2002, 10:44 AM
#7
Software Eng.
I think the idea of a resource file sounds good.
How large (in bytes) are the pictures?
-
Aug 30th, 2002, 10:53 AM
#8
Thread Starter
Lively Member
Originally posted by Megatron
I think the idea of a resource file sounds good.
How large (in bytes) are the pictures?
typically from 200k to 700k.
Can someone explain resource file?
-
Aug 30th, 2002, 10:59 AM
#9
Software Eng.
Resource files are part of the project: Just like Forms, Modules, and Class Modules. Resource files typically contain the program's resources. Resources can be pictures, sounds, strings, and other binary data.
The first step to creating a resource file is to write up a resource script (*.rc file). Then use the resource compiler to compile it into a resource file (*.res).
The resource compiler is located in the Tools\Rc directory of vb. There also a text file that explains how to use it.
-
Aug 30th, 2002, 11:04 AM
#10
-
Aug 30th, 2002, 07:14 PM
#11
Thread Starter
Lively Member
Originally posted by Microbasic
Or, if you have VB6, there's a tool named Resource Editor that creates .res files for your program.
Oh, and I want to add a question, can you replace VB's program icon by add an icon resource with an ID of one?
Hmmmm....dun see this resource editor in the add in manager or the directories mentioned.
-
Aug 30th, 2002, 07:27 PM
#12
Lively Member
why get so complicated?
'put in declarations
public pic1 as picture
public pic2 as picture
private sub form_load()
pic1 = loadpicture ("path to picture here")
pic2 = loadpicture("path to picture here")
end sub
now you just reference an picture/image properties by the variable, like so
image1.image = pic1
or
picture1.picture= pic2
it will be instantaneous with no load time, the only load time will be at the beginning when the pics are loaded into variables.
private sub unload
set pic1 = nothing
set pic2 = nothing
end sub
-
Aug 30th, 2002, 07:38 PM
#13
PowerPoster
Well
How many images are we talking about? Wouldn't it be faster to load them as needed from disk use LoadPicture? The resource file thing would be good for distribution, but I do not think it will make your app faster...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Aug 31st, 2002, 02:08 AM
#14
Thread Starter
Lively Member
1 picture or image box may have many images switching in it.
-
Sep 2nd, 2002, 09:50 AM
#15
PowerPoster
"1 picture or image box may have many images switching in it." does not invalidate golgo13sf's solution in the least. Just switch the picture variables.
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
|