Hello,
I'm developing an osciloscope gui with Lazarus, so I need to draw very
basic graphics (just lines to being with) to show the wave format.
I have lots of dots that the hardware sends me (500 of them). What
component should I put on my form to draw on it's canvas? TImage or
TPaintBox? That is the difference between them?
I've being trying without success since monday ... Can someone provide
me an very basic example that will just draw 10 lines on an white empty
drawing space??
I could not find a very basic graphical example on the examples folder
... maybe I can add one after I get this stuff working...
I thought I could just write to the canvas, and everything would be ok.
I put a TImage on my form, added a OnPaint event to it and wrote:
procedure TForm1.TelaPaint(Sender: TObject);
var
Bitmap: TBitmap;
x, y: Integer;
begin
Bitmap := TBitmap.Create;
try
Bitmap.PixelFormat := pf24bit;
Bitmap.Canvas.Pen.Color := clBlack;
Bitmap.Canvas.MoveTo(0, 0);
for x := 0 to 499 do
begin
y := Medidas[x];
Bitmap.Canvas.LineTo(2 * x,y);
end;
Tela.Canvas.Draw(0, 0, Bitmap);
finally
Bitmap.Free;
end;
end;
Medidas[0..499] is an array of words that contains values that describes
the dots that come from the hardware.
I see nothing on my TImage, eventhougth Medidas contains values like: 0,
4, 5,7,9,12,14,15,19,23,32,...
thanks,
Felipe
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives