Delphi GDI+学习记录(2): 画笔线帽

//线帽
var
 g: TGPGraphics;
 p: TGPPen;
begin
 g := TGPGraphics.Create(Canvas.Handle);
 p:= TGPPen.Create(aclBlue, 8);
 p.SetStartCap(LineCapArrowAnchor); {起点线帽}
 p.SetEndCap(LineCapRoundAnchor);  {终点线帽}
 g.DrawLine(p, 20, 20, 300, 175);
 p.Free;
 g.Free;
end;

线帽样式表:

Delphi 微软 说明
LineCapAnchorMask AnchorMask 指定用于检查线帽是否为锚头帽的掩码。
LineCapArrowAnchor ArrowAnchor 指定箭头状锚头帽。
LineCapCustom Custom 指定自定义线帽。
LineCapDiamondAnchor DiamondAnchor 指定菱形锚头帽。
LineCapFlat Flat 指定平线帽。
LineCapNoAnchor NoAnchor 指定没有锚。
LineCapRound Round 指定圆线帽。
LineCapRoundAnchor RoundAnchor 指定圆锚头帽。
LineCapSquare Square 指定方线帽。
LineCapSquareAnchor SquareAnchor 指定方锚头帽。
LineCapTriangle Triangle 指定三角线帽。
时间: 2024-10-31 00:08:21

Delphi GDI+学习记录(2): 画笔线帽的相关文章

Delphi GDI+学习记录(4): 画笔对齐

//笔对齐 var g: TGPGraphics; p: TGPPen; sb: TGPSolidBrush; rect: TGPRect; begin g := TGPGraphics.Create(Canvas.Handle); p := TGPPen.Create(MakeColor(255,255,0,0),5); sb := TGPSolidBrush.Create(MakeColor(255,255,255,0)); p.SetAlignment(PenAlignmentCenter

Delphi GDI+学习记录(1) 画笔

//画笔 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 :=

Delphi GDI+学习记录(6): 使用画刷建立画笔

//使用画刷建立画笔 var g: TGPGraphics; img: TGPImage; tb: TGPTextureBrush; p: TGPPen; begin g := TGPGraphics.Create(Canvas.Handle); img := TGPImage.Create('c:\temp\small.jpg'); tb := TGPTextureBrush.Create(img); p := TGPPen.Create(tb,36); {参数 1 是画刷; 参数 2 是笔宽

Delphi GDI+学习记录(5): 复合画笔

//复合画笔 var g: TGPGraphics; p: TGPPen; arr: array[0..9] of Single; {10 个元素可以分成 5 条线, 每条线需要起点和终点} begin g := TGPGraphics.Create(Canvas.Handle); p := TGPPen.Create(MakeColor(255,255,0,0),100); {笔宽定为 100 好算帐} arr[0] := 0.00; {第一条线起点} arr[1] := 0.01; {第一条

Delphi GDI+学习记录(3): 虚线画笔

//虚线样式 var g: TGPGraphics; p: TGPPen; begin g := TGPGraphics.Create(Canvas.Handle); p := TGPPen.Create(MakeColor(255,255,0,0),3); g.DrawLine(p, 11, 11, 333, 11); {实线} p.SetDashStyle(DashStyleDashDot); {设置虚线样式} g.DrawLine(p, 11, 33, 333, 33); {绘制任何形状都

Delphi GDI+ 学习记录(28): 图像颜色的数据格式

//指定位图颜色var g,gbit: TGPGraphics; bit1,bit2: TGPBitmap; sb: TGPSolidBrush; begin //Self.Color := clWhite; g := TGPGraphics.Create(Canvas.Handle); sb := TGPSolidBrush.Create(MakeColor(255,0,0)); {画刷为红色} bit1 := TGPBitmap.Create(200, 32, PixelFormat32bp

Delphi GDI+学习记录(21): 颜色

//颜色透明度var g: TGPGraphics; sb: TGPSolidBrush; begin g := TGPGraphics.Create(Canvas.Handle); sb := TGPSolidBrush.Create(MakeColor(128,255,0,0)); {128表示半透明} g.FillRectangle(sb,10,10,100,100); sb.Free; g.Free; end; //使用 GDI+ 的颜色类型var g: TGPGraphics; sb:

Delphi GDI+学习记录(19): 路径

//绘制与填充路径var g: TGPGraphics; path: TGPGraphicsPath; p: TGPPen; sb: TGPSolidBrush; begin g := TGPGraphics.Create(Canvas.Handle); p := TGPPen.Create(MakeColor(128,255,0,0),4); sb := TGPSolidBrush.Create(MakeColor(128,255,255,0)); path := TGPGraphicsPat

Delphi GDI+学习记录(16): 贝塞尔曲线

//画贝塞尔曲线 var g: TGPGraphics; p: TGPPen; begin g := TGPGraphics.Create(Canvas.Handle); p := TGPPen.Create(MakeColor(255,0,0),2); g.DrawBezier(p, 11,11, 88,333, 99,0, 222,111); {参数是画笔与 4 个点的坐标} p.Free; g.Free; end; //使用 TGPPoint 或 TGPPointF var g: TGPG