Главная страница | назад





Article #16999: Changing to a Custom Cursor

 Question and Answer Database
FAQ1999C.txt Changing to a Custom Cursor
Category :VCL
Platform :All
Product :C++Builder 1.x
Question:
How do I change the cursor to a cursor I created?
Answer:
This is a simple task with one little trick.
Steps:
1) Create a new resource in Image Editor. You can use Resource
Workshop if you have it.
2) Add a cursor to this resource file.
3) Save the resource file. If you don't save the resource file
you will run itot errors, and remeber to save the resource
file after every time you cahnge it.
4) Add the Resource file to you BCB project. You can do this
by using the Project Manager.
5) Define a constant that you will use as your cursur. You
probably want to do this in the header file.
ex) const crMyCursor = 5;
6) Now you just have to add this cursor to the Screen.Cursors
array. You do this with the following lines.
ex)
Screen->Cursors[crMyCursor] = LoadCursor (HInstance,
"CURSOR");
//note- this code assumes you named the cursor in your
resource file CURSOR
7) To set the cursor to your cursor, set the Cursor property
of the object you want this to be the cursor for to
crMyCursor.
8) Run your project and enjoy!!!
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99