EMF file operation with GDI [4]: re-painting EMF

Source: Internet
Author: User
In this example:


Code File:
Unit unit1; interfaceuses windows, messages, extensions, variants, classes, graphics, controls, forms, dialogs, stdctrls; Type tform1 = Class (tform) button1: tbutton; Procedure formcreate (Sender: tobject); Procedure formdestroy (Sender: tobject); Procedure formmousedown (Sender: tobject; button: tmousebutton; shift: tshiftstate; X, Y: integer); Procedure formmousemove; shift: tshiftstate; X, Y: integer); Procedure formmouseup (Sender: tobject; button: tmousebutton; shift: tshiftstate; X, Y: integer); Procedure button1click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} var hmetafile: henhmetafile; F: Boolean; X1, Y1: integer; R: trect; Procedure tform1.formcreate (Sender: tobject); const Path = 'C: \ temp \ mymetafile. emf'; begin hmetafile: = getenhmetafile (pchar (PATH); end; Procedure prepare (Sender: tobject); begin prepare (hmetafile); end; Procedure tform1.formmousedown (Sender: tobject; button: tmousebutton; shift: tshiftstate; X, Y: integer); begin F: = true; X1: = x; Y1: = y; R: = rect (x1, Y1, x, Y); end; Procedure tform1.formmousemove (Sender: tobject; shift: tshiftstate; X, Y: integer); begin if not F then exit; drawfocusrect (canvas. handle, R); R: = rect (x1, Y1, x, y); drawfocusrect (canvas. handle, R); R: = rect (x1, Y1, x, y); end; Procedure tform1.formmouseup (Sender: tobject; button: tmousebutton; shift: tshiftstate; X, Y: integer); begin F: = false; playenhmetafile (canvas. handle, hmetafile, R); end; Procedure tform1.button1click (Sender: tobject); begin refresh; end.
 
   
 

Form file:

 
Object form1: tform1 left = 0 Top = 0 caption = 'form1' clientheight = 206 clientwidth = 339 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false position = podesktopcenter oncreate = formcreate ondestroy = formdestroy onmousedown = formmousedown onmousemove = formmousemove onmouseup = formmouseup rows = 96 textheight = 13 object button1: tbutton left = 256 Top = 173 width = 75 Height = 25 caption = 'button1' taborder = 0 onclick = button1click 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.