Solved

Loading TImage at Runtime

Posted on 2000-05-09
12
439 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Using FastMM4... should I enable MMX option? 9 76
Convert Jpg /PNG To GIF 5 120
Dev express lookupcombo 3 14
update joined tables 2 32
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…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

864 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

24 Experts available now in Live!

Get 1:1 Help Now