程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 更多編程語言 >> Delphi >> GDI+ 學習記錄(17): 曲線 - Curve

GDI+ 學習記錄(17): 曲線 - Curve

編輯:Delphi

//畫曲線var
 g: TGPGraphics;
 p: TGPPen;
 pts: array[0..4] of TGPPoint;
begin
 g := TGPGraphics.Create(Canvas.Handle);
 p := TGPPen.Create(MakeColor(255,0,0),4);
 pts[0].X := 11; pts[0].Y := 11;
 pts[1].X := 66; pts[1].Y := 66;
 pts[2].X := 88; pts[2].Y := 222;
 pts[3].X := 111; pts[3].Y := 111;
 pts[4].X := 222; pts[4].Y := 88;
 g.DrawCurve(p, PGPPoint(@pts), Length(pts));
 p.Free;
 g.Free;
end;
//指定曲度var
 g: TGPGraphics;
 p: TGPPen;
 pts: array[0..4] of TGPPoint;
begin
 g := TGPGraphics.Create(Canvas.Handle);
 p := TGPPen.Create(MakeColor(255,0,0),4);
 pts[0].X := 11; pts[0].Y := 11;
 pts[1].X := 66; pts[1].Y := 66;
 pts[2].X := 88; pts[2].Y := 222;
 pts[3].X := 111; pts[3].Y := 111;
 pts[4].X := 222; pts[4].Y := 88;
 g.DrawCurve(p, PGPPoint(@pts), Length(pts), 0.25); //指定曲度為 0.25; 默認是 0.5
 p.Free;
 g.Free;
end;
//繪制曲線的部分var
 g: TGPGraphics;
 p: TGPPen;
 pts: array[0..4] of TGPPoint;
begin
 g := TGPGraphics.Create(Canvas.Handle);
 p := TGPPen.Create(MakeColor(255,0,0),4);
 pts[0].X := 11; pts[0].Y := 11;
 pts[1].X := 66; pts[1].Y := 66;
 pts[2].X := 88; pts[2].Y := 222;
 pts[3].X := 111; pts[3].Y := 111;
 pts[4].X := 222; pts[4].Y := 88;
 g.DrawCurve(p, PGPPoint(@pts), Length(pts), 1, 2, 0);
 {參數 3 指定從第幾個點開始; 參數 4 指示繪制幾段; 參數 5 是曲度為 0 時就成了連續的直線}
 p.Free;
 g.Free;
end;


//畫曲線var
 g: TGPGraphics;
 p: TGPPen;
 pts: array[0..4] of TGPPoint;
begin
 g := TGPGraphics.Create(Canvas.Handle);
 p := TGPPen.Create(MakeColor(255,0,0),4);
 pts[0].X := 11; pts[0].Y := 11;
 pts[1].X := 66; pts[1].Y := 66;
 pts[2].X := 88; pts[2].Y := 222;
 pts[3].X := 111; pts[3].Y := 111;
 pts[4].X := 222; pts[4].Y := 88;
 g.DrawCurve(p, PGPPoint(@pts), Length(pts));
 p.Free;
 g.Free;
end;
//指定曲度var
 g: TGPGraphics;
 p: TGPPen;
 pts: array[0..4] of TGPPoint;
begin
 g := TGPGraphics.Create(Canvas.Handle);
 p := TGPPen.Create(MakeColor(255,0,0),4);
 pts[0].X := 11; pts[0].Y := 11;
 pts[1].X := 66; pts[1].Y := 66;
 pts[2].X := 88; pts[2].Y := 222;
 pts[3].X := 111; pts[3].Y := 111;
 pts[4].X := 222; pts[4].Y := 88;
 g.DrawCurve(p, PGPPoint(@pts), Length(pts), 0.25); //指定曲度為 0.25; 默認是 0.5
 p.Free;
 g.Free;
end;
//繪制曲線的部分var
 g: TGPGraphics;
 p: TGPPen;
 pts: array[0..4] of TGPPoint;
begin
 g := TGPGraphics.Create(Canvas.Handle);
 p := TGPPen.Create(MakeColor(255,0,0),4);
 pts[0].X := 11; pts[0].Y := 11;
 pts[1].X := 66; pts[1].Y := 66;
 pts[2].X := 88; pts[2].Y := 222;
 pts[3].X := 111; pts[3].Y := 111;
 pts[4].X := 222; pts[4].Y := 88;
 g.DrawCurve(p, PGPPoint(@pts), Length(pts), 1, 2, 0);
 {參數 3 指定從第幾個點開始; 參數 4 指示繪制幾段; 參數 5 是曲度為 0 時就成了連續的直線}
 p.Free;
 g.Free;
end;


//畫曲線var
 g: TGPGraphics;
 p: TGPPen;
 pts: array[0..4] of TGPPoint;
begin
 g := TGPGraphics.Create(Canvas.Handle);
 p := TGPPen.Create(MakeColor(255,0,0),4);
 pts[0].X := 11; pts[0].Y := 11;
 pts[1].X := 66; pts[1].Y := 66;
 pts[2].X := 88; pts[2].Y := 222;
 pts[3].X := 111; pts[3].Y := 111;
 pts[4].X := 222; pts[4].Y := 88;
 g.DrawCurve(p, PGPPoint(@pts), Length(pts));
 p.Free;
 g.Free;
end;
//指定曲度var
 g: TGPGraphics;
 p: TGPPen;
 pts: array[0..4] of TGPPoint;
begin
 g := TGPGraphics.Create(Canvas.Handle);
 p := TGPPen.Create(MakeColor(255,0,0),4);
 pts[0].X := 11; pts[0].Y := 11;
 pts[1].X := 66; pts[1].Y := 66;
 pts[2].X := 88; pts[2].Y := 222;
 pts[3].X := 111; pts[3].Y := 111;
 pts[4].X := 222; pts[4].Y := 88;
 g.DrawCurve(p, PGPPoint(@pts), Length(pts), 0.25); //指定曲度為 0.25; 默認是 0.5
 p.Free;
 g.Free;
end;
//繪制曲線的部分var
 g: TGPGraphics;
 p: TGPPen;
 pts: array[0..4] of TGPPoint;
begin
 g := TGPGraphics.Create(Canvas.Handle);
 p := TGPPen.Create(MakeColor(255,0,0),4);
 pts[0].X := 11; pts[0].Y := 11;
 pts[1].X := 66; pts[1].Y := 66;
 pts[2].X := 88; pts[2].Y := 222;
 pts[3].X := 111; pts[3].Y := 111;
 pts[4].X := 222; pts[4].Y := 88;
 g.DrawCurve(p, PGPPoint(@pts), Length(pts), 1, 2, 0);
 {參數 3 指定從第幾個點開始; 參數 4 指示繪制幾段; 參數 5 是曲度為 0 時就成了連續的直線}
 p.Free;
 g.Free;
end;


  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved