Gdiplus [30]: igppen: wire cap

Source: Internet
Author: User
The startcap and endcap attributes are used to read and write the line caps of the two segments respectively. Test figure:


Startcap and endcap TestCode:

 
Uses gdiplus; Procedure tform1.formpaint (Sender: tobject); const caparr: array [0 .. 8] of byte = (0, 1, 2, 3, $10, $11, $12, $13, $14); var graphics: igpgraphics; pen: igppen; pt1, pt2: tgppoint; I: integer; begin pt1.initialize (20, 20); pt2.initialize (200, 20); graphics: = tgpgraphics. create (handle); pen: = tgppen. create ($ ff2e8b57, 11); for I: = 0 to length (caparr)-1 do begin pen. startcap: = tgplinecap (caparr [I]); pen. endcap: = pen. startcap; graphics. drawline (pen, pt1, pt2); graphics. translatetransform (0, pt1.y * 1.5); end;

  

The dashcap attribute is used to read and write the dotted line cap, which has no effect in the solid line. test diagram:


Dashcap test code:

 
Uses gdiplus; Procedure injection (Sender: tobject); var graphics: igpgraphics; pen: igppen; pt1, pt2: tgppoint; begin pt1.initialize (20, 20); pt2.initialize (240, 20); graphics: = tgpgraphics. create (handle); pen: = tgppen. create ($ ff4169e1, 11); pen. dashstyle: = dashstyledashdot; pen. dashcap: = dashcapflat; graphics. drawline (pen, pt1, pt2); graphics. translatetransform (0, pt1.y * 1.5); pen. dashcap: = dashcapround; graphics. drawline (pen, pt1, pt2); graphics. translatetransform (0, pt1.y * 1.5); pen. dashcap: = dashcaptriangle; graphics. drawline (pen, pt1, pt2); end;

  

You can use the setlinecap method to set startcap, endcap, and dashcap. The test diagram is as follows:


Setlinecap test code:

Uses gdiplus; Procedure tform1.formpaint (Sender: tobject); var graphics: igpgraphics; pen: igppen; begin graphics: = tgpgraphics. create (handle); pen: = tgppen. create ($ ffc71585, 11); pen. dashstyle: = dashstyledashdot; pen. setlinecap (linecaproundanchor, linecaparrowanchor, dashcaptriangle); graphics. drawline (pen, 20, 30,300, 30); end;

  

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.