如:
type
Tdot = packed Record
X: integer;
Y: ingeger;
end;
var
A,B: array of TDot;
Linelist: Tlist;经过赋值:
A=((10,10), (120,120),(50,50))
B=((40,40), (150,150),(90,90))
并且把A,B做成类(Tline)放到LineList中。 现在我想把两组线段在ImgM中画出来:
procedure Tfrm_main.DrawAll;
var
i,j: Integer;
Tmp: TLine;
SDot,EDot: Tdot;
begin
with ImgM.Picture.Bitmap.Canvas do
begin
for i := 0 to LineList.Count - 1 do
begin
Tmp := LineList.Items[i]; for j := 0 to Tmp.Count - 1 do
begin
SDot := Tmp.Items[j]; EDot := Tmp.Items[j + 1];
if (j = Tmp.Count - 1) then
EDot := Tmp.Items[0]; MoveTo(SDot.X, SDot.Y);
LineTo(EDot.X, EDot.Y)
end;
end;
end;
end;
问题:
两个图形连起来了。 因为循环的Moveto 和Lineto.
请问如何能不连起来。即在第一层循环中断开。
type
Tdot = packed Record
X: integer;
Y: ingeger;
end;
var
A,B: array of TDot;
Linelist: Tlist;经过赋值:
A=((10,10), (120,120),(50,50))
B=((40,40), (150,150),(90,90))
并且把A,B做成类(Tline)放到LineList中。 现在我想把两组线段在ImgM中画出来:
procedure Tfrm_main.DrawAll;
var
i,j: Integer;
Tmp: TLine;
SDot,EDot: Tdot;
begin
with ImgM.Picture.Bitmap.Canvas do
begin
for i := 0 to LineList.Count - 1 do
begin
Tmp := LineList.Items[i]; for j := 0 to Tmp.Count - 1 do
begin
SDot := Tmp.Items[j]; EDot := Tmp.Items[j + 1];
if (j = Tmp.Count - 1) then
EDot := Tmp.Items[0]; MoveTo(SDot.X, SDot.Y);
LineTo(EDot.X, EDot.Y)
end;
end;
end;
end;
问题:
两个图形连起来了。 因为循环的Moveto 和Lineto.
请问如何能不连起来。即在第一层循环中断开。
A=((10,10), (120,120),(50,50))
B=((40,40), (150,150),(90,90))6个点显然在一条直线上,而第二条线(150,150)最大,那想不连在一起都不可能
试过了。没有用。。
回3楼:
呵呵,这个我的失误,点是我随便写的。
我的想法是:两段线有不同的起点。就是前一段线的结束点不跟后面一段的开始点接起来。
重新设一下
A=(0,0),(10,15), (40,30))
B=(20,40),(30,65), (70,90))