Change the mouse pointer

zhaozj2021-02-16  43

Change the mouse pointer

Translation: I can see the mountain today

There are many VCL controls with Cursor properties to change the pointer shape in the area of ​​the mouse in the area of ​​this control. This is good when you only need to change the mouse pointer of a control. But when you need to change the mouse pointer of this screen, it is a bit less than. For example, although you changed a form's Cursor property, the mouse pointer will change back when the mouse moves to other controls of this form. Changing the entire screen's pointer shape should use the full screen CURSOR attribute.

The following list lists all possible values ​​of the screen pointer.

CRDEFAULT

crnone

Crarow

Crcross

CRIBEAM

Crsize

Crsizenesw

Crsizens

Crsizenwse

Crsizewe

CruParrow

CRHOURGLASS

CRDRAG

CRNODROP

CRHSPLIT

CRVSPLIT

CRMULTIDRAG

Crsqlwait

CRNO

Crappstart

crhelp

The following steps describe how to create a user-defined book pointer instead of a pointer that the system can provide.

Step 1: Create a resource file that contains the mouse pointer graphic that you define your own. Then add this resource file to the project.

Step 2: Valid screen pointers, first include system-defined pointer shapes (all values ​​of the CURSORS array attribute of the Tscreen class). Before you use your own defined pointer, you must load it and add it to this CURSORS array. Define a constant that represents your pointer and an index value of an array. Then use the defined index value to load this pointer.

E.g:

Const tcursor crmycustomcursor = 1; // Customize the ID number of the pointer

__fastcall tform1 :: tform1 (tComponent * Owner)

: TFORM (OWNER)

{

// Mount the custom pointer into the Cursors array

// "Cursor1" is the identifier character set with the image editor

Screen-> Cursors [CRMYCUSTOMCURSOR] = loadingcursor ((void *) Hinstance, "CURSOR1");

}

Step 3: Assign the new Cursor value to the Screen-> Cursor property when you want to convert the mouse pointer.

For example: screen-> cursor = crmycustomcursor;

转载请注明原文地址:https://www.9cbs.com/read-28280.html

New Post(0)