+ -
当前位置:首页 → 问答吧 → 关于 Delphi7 颜色画曲线 的问题

关于 Delphi7 颜色画曲线 的问题

时间:2011-08-11

来源:互联网

Delphi(Pascal) code

procedure TForm1.PaintBox1Paint(Sender: TObject);
var
iWidth:Integer;//横轴长度
iHeight:Integer;//纵轴长度
iX,iY:Integer;//数据点坐标
i:Integer;
begin
iWidth:=PaintBox1.Width-1;//横轴长度
iHeight:=PaintBox1.Height-1;//纵轴长度
PaintBox1.Canvas.Rectangle(1,1,iWidth,iHeight);//边框
//绘画曲线
for i:=0 to 1000 do
  begin
      PaintBox1.Canvas.Pixels[iX,iY]:=clRED;
      [color=#FF0000]//PaintBox1.Canvas.Pen.Color:=clRED;[/color]
      PaintBox1.Canvas.MoveTo(iX,iY);
  end;

end;



通过设置Pixels颜色画线,结果的曲线是不连续的,这样不理想;
一般通过画笔来实现带颜色画线,可是使用上面红色注释部分画笔,最后曲线没出来,反倒把Rectangle边框的线变成红线了!
不知所云%¥#

作者: spade24   发布时间: 2011-08-11

怎么只有MoveTo没有LineTo

作者: bdmh   发布时间: 2011-08-11