Board index » delphi » JPEGs to a canvas

JPEGs to a canvas

Hello,
  I would like to be able to open a JPEG file and load it to the canvas of a
PaintBox. Is there any way to do this without investing a couple Ben
Franklins?

I am using Delphi 3, please note I am not trying to encode a JPEG, only
decode it to bmp format.

Any help is greatly appreciated.

Thank you,
Isaac Hall

http://www.isaachall.com

 

Re:JPEGs to a canvas


Quote
MCI 2000 wrote:

> Hello,
>   I would like to be able to open a JPEG file and load it to the canvas of a
> PaintBox. Is there any way to do this without investing a couple Ben
> Franklins?

        well, you really can't quite "load" anything to the canvas of a
paintbox - anything you draw there is going to disappear when the window's
covered and uncovered unless you redraw it. Which is why you do all the
drawing in the paintbox's OnPaint handler - that gets called when a
redraw is needed.

        If you want to Draw a jpg on a paintbox's Canvas you simply say

with Sender as TPaintBox do
begin
 Canvas.Draw(0,0,j);
end;

        That's assuming that j is a TJPEGImage and you've already done
a j.LoadfromFile.

--
David Ullrich

sig.txt not found

Other Threads