MechanicalBoy
Technical User
Hi All !
I have a problem with my image (img). I create it when i click on (butt1) :
TImage *img;
.
.
.
void __fastcall TForm1::butt1Click(TObject *Sender)
{
if((img = new TImage(this))!=NULL)
{
img->SetBounds(0,0,300,10);
img->Canvas->Brush->Color = clGreen;
img->Canvas->FillRect(Rect(0,0,img->Width,img->Height));
img->InsertControl(img);
img->Visible = true;
}
}
when this function terminates everything is OK. I can see green rectangle on the form [resolution (300x10)]
But when i change it's dimensions (by clicking on butt2):
void __fastcall TForm1::butt2Click(TObject *Sender)
{
img->Width += 100;
img->Height += 100;
img->Canvas->Brush->Color = clGreen;
img->Canvas->FillRect(Rect(0,0,img->Width,img->Height));
img->Refresh();
}
I obtain a green rectangle with resolution (300x10) again.
Why it's dimensions are not changed.
Furthermore i know that img is much larger becouse when i replace
img->Width += 100;
img->Height += 100;
by
img->Width += 1000;
img->Height += 1000;
i see automaticly created form scrollbars and it distinctly points that the image is indeed resized.
I think that problem concerns img->Canvas->FillRect() method.
Thanks in advance for any help !
RafalP
I have a problem with my image (img). I create it when i click on (butt1) :
TImage *img;
.
.
.
void __fastcall TForm1::butt1Click(TObject *Sender)
{
if((img = new TImage(this))!=NULL)
{
img->SetBounds(0,0,300,10);
img->Canvas->Brush->Color = clGreen;
img->Canvas->FillRect(Rect(0,0,img->Width,img->Height));
img->InsertControl(img);
img->Visible = true;
}
}
when this function terminates everything is OK. I can see green rectangle on the form [resolution (300x10)]
But when i change it's dimensions (by clicking on butt2):
void __fastcall TForm1::butt2Click(TObject *Sender)
{
img->Width += 100;
img->Height += 100;
img->Canvas->Brush->Color = clGreen;
img->Canvas->FillRect(Rect(0,0,img->Width,img->Height));
img->Refresh();
}
I obtain a green rectangle with resolution (300x10) again.
Why it's dimensions are not changed.
Furthermore i know that img is much larger becouse when i replace
img->Width += 100;
img->Height += 100;
by
img->Width += 1000;
img->Height += 1000;
i see automaticly created form scrollbars and it distinctly points that the image is indeed resized.
I think that problem concerns img->Canvas->FillRect() method.
Thanks in advance for any help !
RafalP