Solved

Loading TImage at Runtime

Posted on 2000-05-09
12
444 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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 this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Suggested Courses
Course of the Month7 days, 5 hours left to enroll

622 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