Learn more about GDI + [34]: tgppen-scale and transform the paint brush-scaletransform

Source: Internet
Author: User
In this example:


Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls, comctrls; Type tform1 = Class (tform) trackbar1: ttrackbar; trackbar2: ttrackbar; Procedure procedure (Sender: tobject); Procedure trackbar1change (Sender: tobject); Procedure trackbar2change (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} uses gdipobj, gdipapi; Procedure upload (Sender: tobject); begin trackbar1.showselrange: = false; trackbar1.height: = 20; trackbar1.min: = 1; trackbar1.max: = 100; trackbar1.position: = 10; trackbar2.showselrange: = false; trackbar2.height: = 20; trackbar2.min: = 1; trackbar2.max: = 100; trackbar2.position: = 10; end; Procedure tform1.formpaint (Sender: tobject ); vaR G: tgpgraphics; P: tgppen; R: trect; begin G: = tgpgraphics. create (canvas. handle); P: = tgppen. create (aclbrown, 3); p. scaletransform (trackbar1.position/10, trackbar2.position/10); R: = clientrect; inflaterect (R,-30,-30); offsetrect (R, 0,-10); G. drawellipse (p, makerect (R); p. free; G. free; end; Procedure tform1.trackbar1change (Sender: tobject); begin repaint; end; Procedure tform1.trackbar2change (Sender: tobject); begin repaint; end.
 
   
 

Form file:

 
Object form1: tform1 left = 0 Top = 0 caption = 'form1' clientheight = 196 clientwidth = 296 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false position = pow.topcenter oncreate = formcreate onpaint = formpaint pixelsperinch = 96 textheight = 13 object trackbar1: ttrackbar left = 2 Top = 172 width = 143 Height = 45 taborder = 0 onchange = trackbar1change end object trackbar2: ttrackbar left = 151 Top = 172 width = 143 Height = 45 taborder = 1 onchange = trackbar2change endend

  

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.