Solved

Loading TImage at Runtime

Posted on 2000-05-09
12
436 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
Comment Utility
Ben,

That's not to difficult, try this:

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

Regards,


Paul
0
 
LVL 13

Expert Comment

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

Expert Comment

by:edey
Comment Utility
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
 
LVL 1

Expert Comment

by:saulite
Comment Utility
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
Comment Utility
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
Comment Utility
edey is right!! The most important part is the Image1.Picture.LoadFromFile part, and that information was posted lang before your comment was.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 13

Expert Comment

by:Epsylon
Comment Utility
I agree with Mike and dentener.

Very disturbing too.
0
 
LVL 1

Expert Comment

by:AttarSoftware
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
THanks alot

Ben
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now