Archived

This topic is now archived and is closed to further replies.

Cursor

This topic is 5571 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

You can either load it from a resource or a file on your hard disk.
To get a cursor into a RES file, use the editor that comes with Delphi (In delphi click Tools -> Image Editor) or borland''s resource compiler (also comes with Delphi, can be found in the BIN directory).

to load a cursor you have to declare a cursor constant first, for example

const
crCoolCursor = 5;

now if you''re loading your cursor from a RES file, do it like this:
const

Screen.Cursors[crCoolCursor] := LoadCursor(HInstance, ''CoolCursor'');

you can load a resource like this

{$R MYCURSORS.RES}

way up where the other compiler directives are.

to load a cursor from a cursor file (.CUR or .ANI), do the following:

Screen.Cursors[crCoolCursor] := LoadCursorFromFile(PChar(''C:\cool.cur'');

once the cursor is loaded, you can do this:

Form1.Cursor := crCoolCursor; or
Screen.Cursor := crCoolCursor;


loading cursors from RES files is more elegant since it won''t require any files to be stored outside the EXE.

Share this post


Link to post
Share on other sites