Seventh chapter-Clipboard and Dynamic Data Exchange (i) (2)

Source: Internet
Author: User

The method of table 7.3 Tclipboard

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Method parameter Meaning

─────────────────────────────────────

Clear the contents of the Clipboard are not cleared

Assign source:tpersistent copies the object specified by the Source parameter to the Clipboard, often

For graphics, image objects

Open the Clipboard without opening it, preventing other applications from changing its contents

Close without closing the open clipboard

SetComponent source:tpersistent Copy the parts to the Clipboard

Getcomponent Owner retrieves a part from the Clipboard and places

Parent:tpersistent

Setashandle Format:word give the handle of the specified format data to the Clipboard

return type: Thandle

Getashandle Format:word Returns a handle to the Clipboard-specified format data

return type: Thandle

Hasformat Format:word determine if the Clipboard has a given format

return type: Boolean

Settextbuf Buffer:pchar Set the Clipboard text content

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

The possible data formats in the Clipboard are the following table.

Table 7.4 Clipboard data format and its significance

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Data format meaning

──────────────────────────────

Cf_text text. Each line ends with CF_LF, nil flag text ends

Cf_bitmap Windows Bitmap

Cf_metafile Windows Meta File

Cf_picture tpicture type of Object

Cf_object any tpersistent type of object

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Use Tclipboard to implement text transfer using Astext properties and Settextbuf methods.

The Astext property provides convenience for clipboard operations for non-control parts. Such as:

Clipboard. Astext: = form1.caption;

Copy the Form1 title to the Clipboard.

Label1.Caption: = Clipboard.astext;

Writes the text from the Clipboard to the Label1.

Settextbuf is used to handcuff a string of more than 255 characters to the Clipboard.

7.1.3 Use the Clipboard to transfer images

7.1.3.1 Copy

The content on the image part and the graphics on the form can be copied directly to the Clipboard. The image copy utilizes the Clipboard assign method.

For example:

Clipboard.assign (image1.picture);

Copy the image on the Image1 to the Clipboard.

7.1.3.2 Shearing

Image cutting is the first copy of the image to the Clipboard, and then in the original location with a blank image to cover.

The following procedure represents the clipping of an image.

Procedure Tform1.cut1click (Sender:tobject);

Var

Arect:trect;

Begin

Clipboard.assign (image1.picture);

With Image.canvas do

Begin

Copymode: = cmwhiteness;

Arect: = Rect (0, 0, image.width, image.height);

Copyrect (Arect, Image.canvas, Arect);

Copymode: = cmsrccopy;

End

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.