Link to home
Start Free TrialLog in
Avatar of ginsonic
ginsonicFlag for Romania

asked on

TPicture : Where is wrong ?

Hi to all .
I have 3 TPicture objects and a Canvas .

Pic1 - store a jpeg file
Pic2 - store a jpeg file
and Pic3 - store a black bitmap :
 
Pic3.Bitmap.Canvas.Brush.Color:=clBlack;
Pic3.Bitmap.Canvas.FillRect(RECT(0,0,200,200));

For the case :
   Canvas.Draw(0,0,Pic1.Graphic);
I can see in canvas Pic 1 .

For the case :
   Pic1.Assign(Pic2);
   Canvas.Draw(0,0,Pic1.Graphic);
I can see in canvas Pic 2 .

But for :
   Pic1.Assign(Pic3);
   Canvas.Draw(0,0,Pic1.Graphic);
I can't see anything . In normal case I must see a black square .

Where I wrong ?
Avatar of kretzschmar
kretzschmar
Flag of Germany image

hi ginsonic,

maybe you must the picture first tell the width and height of the bitmap like

Pic3.Bitmap.Width := 200;
Pic3.Bitmap.Height := 200;
Pic3.Bitmap.Canvas.Brush.Color:=clBlack;
Pic3.Bitmap.Canvas.FillRect(RECT(0,0,200,200));

meikl
Yes, it's importent to set the width and height of bitmaps created in runtime.
/Probie
Avatar of ginsonic

ASKER

What stupid I am :P

Kretzschmar  thanks for help .
Put an answer please.
ASKER CERTIFIED SOLUTION
Avatar of kretzschmar
kretzschmar
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial