应该用什么组件?用到哪些方法?具体的算法,请指点,谢谢!

解决方案 »

  1.   

    用TCanvas、TPen、TBrush。
    这几个组件是VCL对windowsGDI函数的封装。TCavans是TForm的一个成员。TPen、TBrush是TCavans的成员。可以在form的OnPaint事件里填写绘图代码。
    这样:
      canvas.moveto(orix,oriy);
      canvas.lineto(width,oriy);
      canvas.Pen.color:=clred;
      canvas.Arc(orix-r1,oriy-r1,orix+r1,oriy+r1,orix+r1,height div 2,orix+r1,height div 2);
      canvas.Pen.color:=clgreen;
    可以看看帮助里,这几个类的参考。
      

  2.   

    画函数的组件:timage,tcanvas
    事件:arc(x1,y1,x2,y2,x3,y3:integer),chord(x1,y1,x2,y2,x3,y3:integer),
    draw(x,y),brushcopy ,ellipse lineto(x,y:integer)   moveto(x,y:integer)
    pie(x1,y1,x2,y2,x3,y3:integer),polygon(points:array of tport) 
    polyline(points:array of tport)
      

  3.   

    用TCanvas、TPen、TBrush。
    这几个组件是VCL对windowsGDI函数的封装。TCavans是TForm的一个成员。TPen、TBrush是TCavans的成员。可以在form的OnPaint事件里填写绘图代码。
    这样:
      canvas.moveto(orix,oriy);
      canvas.lineto(width,oriy);
      canvas.Pen.color:=clred;
      canvas.Arc(orix-r1,oriy-r1,orix+r1,oriy+r1,orix+r1,height div 2,orix+r1,height div 2);
      canvas.Pen.color:=clgreen;
    可以看看帮助里,这几个类的参考。
      

  4.   

    看一下此网址:http://www.xydot.com/delphi/math.htm
    你所要的,保证满足
    A TGraphicControl descendant which allows drawing in world coordinates. Both 2-D and 3-D graphs are supported. Surfaces can be drawn filled with hidden invisible parts and with a simple light source
      

  5.   

    关注,我还想知道,如何进行平移!即我画出一个 y=sinx的图像,然后把它进行平移。这个怎么实现?
      

  6.   

    你想怎樣平移?只是重畫的話,canvas.moveto(x,y)就行了
    就將當前的(0,0)移到了(x,y),你再重畫就ok了如果你想用鼠標脫動的話…… 哪就比較麻煩了
      

  7.   

    其實也沒什麽的直綫為例var  i:integer;procedure TForm1.FormMouseDown(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
      i:=0;
    end;
    procedure TForm1.FormMouseUp(Sender: TObject; Button: TMouseButton;
      Shift: TShiftState; X, Y: Integer);
    begin
      i:=1;
    end;
    procedure TForm1.FormMouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
    begin
    if i=0 then
      begin
        canvas.MoveTo(x-50,y-50);
        Canvas.LineTo(x+50,y+50);
      end;
    end;你運行一下看看效果,如果想只顯示最後一次的直綫。清空畫布就行了畫正弦函數一樣的,仔細調一下就行了