• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 170
  • Last Modified:

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 ?
0
ginsonic
Asked:
ginsonic
  • 2
1 Solution
 
kretzschmarCommented:
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
0
 
ProbieCommented:
Yes, it's importent to set the width and height of bitmaps created in runtime.
/Probie
0
 
ginsonicAuthor Commented:
What stupid I am :P

Kretzschmar  thanks for help .
Put an answer please.
0
 
kretzschmarCommented:
hi ginsonic,

glad to helped you
good luck again

meikl ;-)
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now