Learn more about GDI + [71]: path painter (11)-rotatetransform, scaletransform, and other transformations

Source: Internet
Author: User
Rotatetransform {rotation} scaletransform {scaling} translatetransform {translation} settransform {integrated matrix transformation} resettransform {cancel transformation}

  

In this example:


Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, comctrls, stdctrls, extctrls; Type tform1 = Class (tform) trackbar1: ttrackbar; trackbar2: ttrackbar; Procedure alert (Sender: tobject); Procedure trackbar1change (Sender: tobject); Procedure trackbar2change (Sender: tobject); end; vaR form1: tform1; implementation {$ R *. DFM} uses gdipobj, gdipapi; Procedure plugin (Sender: tobject); begin trackbar1.min: =-50; trackbar1.max: = 50; trackbar1.position: = 0; trackbar2.min: = 1; trackbar2.max: = 10; trackbar2.position: = 10; end; Procedure tform1.formpaint (Sender: tobject); const colors: array [0 .. 3] of tgpcolor = (aclred, aclyellow, aclgreen, aclblue); var G: tgpgraphics; P: tgppen; Path: tgpgraphicspath; Pb: tgppathgradientbrush; num: integer; begin G: = tgpgraphics. create (canvas. handle); P: = tgppen. create (aclred); Path: = tgpgraphicspath. create; Path. addrectangle (makerect (50, 20,120,100); Pb: = tgppathgradientbrush. create (PATH); num: = length (colors); Pb. setsurroundcolors (@ colors, num); // Pb. resettransform; Pb. rotatetransform (trackbar1.position); Pb. scaletransform (trackbar2.position/10, trackbar2.position/10); G. fillpath (Pb, PATH); G. drawpath (p, PATH); Pb. free; Path. free; 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 = 165 clientwidth = 222 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 = 13 Top = 136 width = 100 Height = 23 showselrange = false taborder = 0 onchange = trackbar1change end object trackbar2: ttrackbar left = 110 Top = 134 width = 100 Height = 23 showselrange = false 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.