dynamic TImage component creation

M

macbul

(C++ Builder 6.0 enterprise)



I tried to create a TImage component by using this source code:



// ---

TImage *Image = new TImage (Application);

Image->Picture->LoadFromFile ("a.bmp");

// ---



There are no errors, but the image does not apear on the form. I also
tried setting properties, like: Left, Top, Height, Width, Visible, but
that didn't change anything.



Maybe I'm doing something wrong or I'm forgeting to do something. I
would be thankful for helping me out.



Maciej Bulaszewski, Poland
 
I

Ivan Vecerina

macbul said:
(C++ Builder 6.0 enterprise)

Note: this is out of topic here.
Some will flame you for being OT, but most importantly
your chances of getting a helpful answer are much slimmer
than on a dedicated NG ( i.e. borland...., see their web site).
TImage *Image = new TImage (Application);

Image->Picture->LoadFromFile ("a.bmp"); ....
There are no errors, but the image does not apear on the form. I also
tried setting properties, like: Left, Top, Height, Width, Visible, but
that didn't change anything.

You probably need to create the Image within a specific Form,
not as a child of the Application object...


Regards,
 
D

Duane Hebert

Ivan Vecerina said:
Note: this is out of topic here.
Some will flame you for being OT, but most importantly
your chances of getting a helpful answer are much slimmer
than on a dedicated NG ( i.e. borland...., see their web site).


You probably need to create the Image within a specific Form,
not as a child of the Application object...

Not sure about TImeage but most VCL visual stuff requires an owner and a
parent.
Also, LoadFromFile() probably throws on failure so you would need a
try/catch to handle
errors.

TImage *Image = new TImage (Application);
Image->Parent = this; // or wherever you want the bitmap
try{
Image->Picture->LoadFromFile ("a.bmp")
} catch(Exception &spoo) {
//whatever on failure
}

This is the wrong place for this question though. Try
newsgroups.borland.com and subscribe to
borland.public.cppbuilder.vcl.components.using
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top