Solved

Loading TImage at Runtime

Posted on 2000-05-09
12
440 Views
Last Modified: 2010-04-04
Loading TImage at Runtime

How do I get my app to load up images at run-time
and not at design-time

Cos far as I know
If I add a bitmap or a jpg on my form
it tends to convert that image into binary form in one of my software binary files and then makes my software run extremely slow cos the image is classed as how sliders and dragboxes are classed in binary form
so how do I get it to load up images from my harddrive without using the opendialog feature
Im sure its something easy to figure out, but I cant find it in my help manual.
I am using TImage

Any one know how to do it?
0
Comment
Question by:Ben_iti
  • 3
  • 2
  • 2
  • +3
12 Comments
 

Accepted Solution

by:
dentener earned 50 total points
ID: 2792063
Ben,

That's not to difficult, try this:

Image1.Picture.LoadFromFile('blabla.bmp');

Regards,


Paul
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2792262
If you put 'JPEG' in the uses clause you can also load jpeg-files....
0
 
LVL 6

Expert Comment

by:edey
ID: 2793321
The difference here being that if your app is going to *NEED* a pix, loading it at runtime is prob a bad idea, simply because there is no way to ensure that it will be there, save compiling it in with your app (as a reasource)

Gl
Mike
0
ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

 
LVL 1

Expert Comment

by:saulite
ID: 2796034
You simpy must use a command:

     Image1.Picture.LoadFromFile(FileName);

If you want to load Bitmaps and Metafiles, you should werify that unit "graphics" is in your uses list, but if you also want to load JPEG's then you must manually add "jpeg" to your uses list.
0
 
LVL 6

Expert Comment

by:edey
ID: 2796505
saulite, I don't mean to be rude, but prposing an answer that is merely a "rehash" or previous comments *is* considered, well, rather rude.


GL
Mike
0
 

Expert Comment

by:dentener
ID: 2796528
edey is right!! The most important part is the Image1.Picture.LoadFromFile part, and that information was posted lang before your comment was.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2797162
I agree with Mike and dentener.

Very disturbing too.
0
 
LVL 1

Expert Comment

by:AttarSoftware
ID: 2800653
Hee hee, that is the funniest bit of answer poaching I have seen in a long time...

Should be included in the dictionary under "blatant"

hee, hee, hee...

Tim.
0
 
LVL 1

Expert Comment

by:saulite
ID: 2800846
But what else can i say? That's the right answer. Of course, there is one moore way, how to do that.


procedure TForm1.Button1Click(Sender: TObject);
var
  Bitmap1: TBitmap;
begin
  Bitmap1:=TBitmap.create;
  Bitmap1.LoadFromFile('bitmap1.bmp');
  Image1.Picture.Assign(Bitmap1);
  Bitmap1.Free;
end;

But it's almost the same, except you can assign Bitmap1 to moore than 1 component.
0
 

Expert Comment

by:dentener
ID: 2801029
If I was using your 'method' of answering, then I would have posted a lot of good answers....

The fact remains that you just copied fragments of our comments and posted a new comment as if you 'found' the answer...

AttarSoftware is right, maybe you should look up 'blatant' in the dictionary.
0
 

Author Comment

by:Ben_iti
ID: 2816492
Thanks Saulite but im going have to unaccept your answer

When I sent the question
Dentener was the first to reply to my question with the correct answer to my question.

When I tryed it the solution out, it worked!

The points go to your Dentener
Dentener, send me a proposed answer thingee and i'll accept it.
Thanks

Ben
0
 

Author Comment

by:Ben_iti
ID: 2816494
THanks alot

Ben
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question