Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Image at runtime 1

Status
Not open for further replies.

kristof

Programmer
Jun 2, 2000
234
BE
Hi all,

Suppose I have a variable: img : TImage;.

Then, at the onCreate of the form I do the following:

Code:
img := TImage.Create;
img.autosize := true;
img.Picture.LoadFromFile('someBMP.bmp');

I get no errors, but still, the image isn't active.
(ie. not shown).

If I check its properties, all values seem normal. Checking the visible and enabled property returns true for both.
Changing the cursor doesn't change a thing either.

Is there something else I should do to active the image, that I'm missing now?

Gtz,

Kristof
 
You need to assign the images parent, for example


Code:
img := TImage.Create(form1);
img.autosize := true;
img.Picture.LoadFromFile('c:\my.bmp');
img.Parent := form1;

X-) Billy H

bhogar@acxiom.co.uk
 
Hi WildWill,

This will make my life a lot easier since I regularly work with over 50 images, and setting those at designtime can be a heck of a job :p, so thanks!

Gtz,

Kristof
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top