Forum > Beginners

Tbitmap how to use?

(1/1)

kr1d:
var
bmp:Tbitmap;
pic:Tpicture;
...
pic:=Tpicture.create;
pic.loadfromfile('c:\tmp\test.png');

bmp:=Tbitmap.create;
bmp.setSize(pic.width, pic.height);

bmp.Canvas.Draw(0,0,pic.Graphic);

But bmp.width = 0 ... Why? What I need to do to make this work?

zeljko:
And what is size of TPicture ? Are you sure that test.png is properly loaded ?
Have you tried bmp.Width := pic.Width; bmp.Height := pic.Height; ?

kr1d:
@zeljko, I can see Tpicture by drawing it on Form1. I mean 'test.png' is loaded and it works well. I'm not sure about Tbitmap part.

Navigation

[0] Message Index

Go to full version