//畫筆
var
g: TGPGraphics;
p: TGPPen;
begin
g := TGPGraphics.Create(Canvas.Handle);
p := TGPPen.Create(aclRed, 2);
{參數1顏色; 參數2是筆寬, 筆寬是可選, 默認 1}
g.DrawEllipse(p, 11, 11, 222, 111);
p.Free;
g.Free;
end;
//設置筆寬與顏色
var
g: TGPGraphics;
p: TGPPen;
begin
g := TGPGraphics.Create(Canvas.Handle);
p := TGPPen.Create(aclBlack);
{建立時應該不給參數是可以的, 但在測試中不行, 至少要給一個顏色}
p.SetColor(aclBlue); {設置顏色}
p.SetWidth(10); {設置筆寬}
g.DrawEllipse(p, 11, 11, 222, 111);
p.Free;
g.Free;
end;
//獲取筆寬與顏色
var
g: TGPGraphics;
p: TGPPen;
c: TGPColor;
begin
g := TGPGraphics.Create(Canvas.Handle);
p := TGPPen.Create(MakeColor(128,0,0,255), 10);
g.DrawEllipse(p, 11, 11, 222, 111);
p.GetColor(c); {獲取顏色給 c}
ShowMessage(IntToHex(c, 8)); {轉換為十六進制: 800000FF}
ShowMessage(FloatToStr(p.GetWidth)); {10}
p.Free;
g.Free;
end;