Re:Drawing lines on top of JPEG image
In article <MPG.10f44fb7af408e41989...@news.xs4all.nl>,
nospam!...@dds.nl (Peter) wrote:
Quote
> I need to draw lines on top of a JPEG image, but when I try to use
> Image1.Canvas.LineTo (x,y) I get the error message 'Can only modify an
> image if it contains a bitmap' (Delphi 3).
> I've also tried putting a TPaintBox on top of the image, but lines drawn
> on the PaintBox1.Canvas won't 'stick' when the window needs to be redrawn
> (due to resizing of other programs that cover the window).
> Is there ANY way, apart from converting all JPEG files to BMP files, I
> can get (diagonal) lines on top of my image, that get updated whenever
> the window is redrawn?
If you want to use an image you could Assign your JPEG to a
bitmap and draw on it:
theJPEG.LoadFromFile('whatever.jpg');
Image1.Picture.Bitmap.Assign(theJPEG);
theJPEG.Free;
Any time you use a paintbox you need to do _all_ your
drawing in the paintbox's OnPaint event handler. Like you
might have a TBitmap B, and the OnPaint handler would be
something like
with (Sender as TPaintBox).Canvas do
begin
Draw(0, 0, B);
MoveTo(0, 0);
LineTo(100, 100);
end;
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own