Delphi's drawing function [4]-Circular Arc graphics

Source: Internet
Author: User
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) button1: tbutton; button2: tbutton; button3: tbutton; button4: tbutton; button5: tbutton; Procedure upload (Sender: tobject); Procedure button1click (Sender: tobject); Procedure button2click (Sender: tobject ); procedure button3click (Sender: tobject); Procedure button4click (Sender: tobject); Procedure button5click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} var BTN: tbutton; const Y1 = 10; y2 = 80; {set paint brush first} procedure tform1.formcreate (Sender: tobject); begin canvas. pen. width: = 2; canvas. pen. color: = clred; canvas. brush. color: = clwhite; end; {draw an elliptic; the parameters of the elliptic are the same as those of the rectangle} procedure tform1.button1click (Sender: tobject); begin BTN: = tbutton (sender); canvas. ellipse (BTN. left, Y1, BTN. left + Btn. width, Y2); end; {draw an elliptic Based on the rectangular structure} procedure tform1.button2click (Sender: tobject); var R: trect; {define a rectangular structure} begin BTN: = tbutton (sender); R: = rect (BTN. left, Y1, BTN. left + Btn. width, Y2); canvas. ellipse (r); end; {draw slice} procedure tform1.button3click (Sender: tobject); begin BTN: = tbutton (sender); canvas. pie (BTN. left, Y1, {upper left corner of the rectangle} BTN. left + Btn. width, Y2, {bottom right corner of the rectangle} BTN. left + Btn. width, Y1 + (y2-y1) Div 2, {sector start} BTN. left + Btn. width Div 2, Y1 {fan end}); end; {draw string, parameter same as above} procedure tform1.button4click (Sender: tobject); begin BTN: = tbutton (sender); canvas. chord (BTN. left, Y1, BTN. left + Btn. width, Y2, BTN. left + Btn. width, Y1 + (y2-y1) Div 2, BTN. left + Btn. width Div 2, Y1); end; {draw an arc, the parameter is the same as above} procedure tform1.button5click (Sender: tobject); begin BTN: = tbutton (sender); canvas. ARC (BTN. left, Y1, BTN. left + Btn. width, Y2, BTN. left + Btn. width, Y1 + (y2-y1) Div 2, BTN. left + Btn. width Div 2, Y1); end.
 
   
 //:


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.