用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; 可以看看帮助里,这几个类的参考。
画函数的组件: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)
用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; 可以看看帮助里,这几个类的参考。
看一下此网址: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
这几个组件是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;
可以看看帮助里,这几个类的参考。
事件: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)
这几个组件是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;
可以看看帮助里,这几个类的参考。
你所要的,保证满足
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
就將當前的(0,0)移到了(x,y),你再重畫就ok了如果你想用鼠標脫動的話…… 哪就比較麻煩了
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;你運行一下看看效果,如果想只顯示最後一次的直綫。清空畫布就行了畫正弦函數一樣的,仔細調一下就行了