Recent

Author Topic: Step by step drawing of a curve  (Read 4566 times)

epsilon

  • New Member
  • *
  • Posts: 21
Step by step drawing of a curve
« on: March 04, 2005, 12:50:12 pm »
Hallo everybody.
I have a TImage on my form and I want to draw a curve step by step - because of visualization. But if I use Repaint or Sleep(a time) after LineTo(x,y), it does nothing - the whole curve is designed immediately.

Thank's for help.

Epsilon

marmin

  • Jr. Member
  • **
  • Posts: 86
    • http://www.naton.org
Step by step drawing of a curve
« Reply #1 on: March 04, 2005, 11:08:55 pm »
can you place more of your code?
you can also try a for-loop between the lineto , to fill any time.
if you do a repaint it paints everything that's on the canvas immediately.
Marmin^.Style
Location: Pointer Land!

epsilon

  • New Member
  • *
  • Posts: 21
Step by step drawing of a curve
« Reply #2 on: March 07, 2005, 11:19:10 am »
O.K. If I put a TImage on the TForm, the following code works fine:
Code: [Select]
procedure TForm1.Button4Click(Sender: TObject);
 var i: integer;
begin
With Image3 do
 begin
  DoubleBuffered:=True;
  Canvas.Brush.Color:=clWhite;
  Canvas.Pen.Color:=clRed;
  Canvas.Fillrect(Rect(0,0,width,height));
  Canvas.MoveTo(0, Height div 2);
  for i:=0 to 6283 do
  begin
   Canvas.LineTo(Round(i*width/6283), Round((Height div 2)*(1+SIN(i/1000))));
   if ((i mod 10)=0) then begin Application.ProcessMessages; Repaint; end;
  end;
 end;
end;

But, if I put the TImage on a TTabSheet of a TPageControl, the image blinks - there are gray strips. Try it and you will see.
Epsilon

 

TinyPortal © 2005-2018