> 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;

The following code draws a blue line on red background on a Timage on a
form:

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  // Fill in background
  Image1.Canvas.Brush.Color := clRed;
  Image1.Canvas.Rectangle(0, 0, Image1.Width, Image1.Height);
  
  // Draw a line
  Image1.Canvas.Pen.Color := clBlue;
  Image1.Canvas.MoveTo(0,0);
  Image1.Canvas.LineTo(50, 50);
end;

Christo
----------------------------------------------------------------------------
NOTICE: Please note that this eMail, and the contents thereof, 
is subject to the standard Sasol eMail legal notice which may be found at: 
http://www.sasol.com/legalnotices                                               
                                                           

If you cannot access the legal notice through the URL attached and you wish 
to receive a copy thereof please send an eMail to 
[EMAIL PROTECTED]
----------------------------------------------------------------------------

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to