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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with Image visibility

Status
Not open for further replies.

MechanicalBoy

Technical User
Aug 11, 2002
11
0
0
PL
I have two buttons on the form (butt1 and butt3).
when i click on butt1 i start the following fuction :

void __fastcall TForm1::butt1Click(TObject *Sender)
{
if((IMG = new TImage(this))!=NULL) ShowMessage("Error ! [cannot create it]");
IMG->SetBounds(10,10,60,60);
IMG->Canvas->Brush->Color = clBlue;
IMG->Canvas->FillRect(Rect(0,0,IMG->Width,IMG->Height));
IMG->Visible = true;
}

but why the image (IMG) is not visible ???

Thanks for any help
RafalP
 
What happens when you refresh or redraw your form?
James P. Cottingham

I am the Unknown lead by the Unknowing.
I have done so much with so little
for so long that they think I am now
qualified to do anything with nothing.
 
Hi

try this....
--------------------------------------------------------

TImage *IMG; // ** I assume you did this somewhere else?
if((IMG = new TImage(this))==NULL)
ShowMessage("Error ! [cannot create it]");
//---
Form1->InsertControl(IMG); //** ADDED THIS LINE **
//---
IMG->SetBounds(10,10,60,60);
IMG->Canvas->Brush->Color = clBlue;
IMG->Canvas->FillRect(Rect(0,0,IMG->Width,IMG->Height));
IMG->Visible = true;

---------------------------------------------------- Rod
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top