|
Microsoft Visual Studio 2005 provides a rich collection of cursors you can
easily use in your application. You can apply them to any control as you wish.
To support cursors, the .NET Framework provides two classes.
One of the classes used for cursors is called Cursors.
This sealed class mostly contains a list of available cursors as
properties. Another technique consists of using a cursor not listed in the
Properties window. A cursor is based on the Cursor class. Both the Cursors
and the Cursor classes are defined in the System.Windows.Forms
namespace that is part of the System.Windows.Forms.dll library.
|
Practical Learning: Introducing Cursors
|
|
- From the Common Controls section of the Toolbox, click the ListBox control
and click the upper-left section of the form
- From the Containers section of the Toolbox, click the Panel control
and click the upper-right section of the form
- Once again, from the Common Controls section of the Toolbox, click the TreeView control
and click the lower-left section of the form
- From the Common Controls section of the Toolbox, click the RichTextBox control
and click the lower-right section of the form

A cursor is primarily represented in Microsoft Windows as a
(resource) file. This means that, to get a cursor, you can design one.
Fortunately, Microsoft Windows and the .NET Framework provides many cursors
ready to be used. Otherwise, you can create and design your own.
To create a cursor, you can use use
Microsoft Visual Studio. To start, on the main menu, you can click Project -> Add
New Item... In the Templates list, you can click Cursor File, give it a name, and
click
Add.
A cursor is a Windows file that has the extension .cur.
|
Practical Learning: Creating a Cursor
|
|
- On the main menu, you can click Project -> Add
New Item...
- In the Templates list, click Cursor File
- Change the Filename to push and click Add
-
On the main menu, click File -> Save push.cur As...
-
Locate and display the bin sub-folder of your project
-
Double-click Debug to select that folder
-
Click Save
- On the Image Editor toolbar, click the Line tool
. In the
Colors window, make sure the black color is selected
- Draw a vertical line from the pixel on the 6th column and 2nd row from top
- Draw a diagonal line at 45˚ from the top border of the new line to
the lower-right until the line is at 5 pixels from the right border of the
drawing area
- Draw a horizontal line from the lower border of the dialog line to
half-left
- Draw a diagonal line from the lower border of the vertical line to the
left border of the horizontal line:
- Draw another diagonal line from the top corner of the current shape to the
intersection of horizontal and left diagonal line:
- On the Image Editor toolbar, click Fill
- In the Colors window, click the button with a pink monitor
- In the drawing area, click the right triangle.
- In the Colors window, click the white color
- On the drawing area, click in the left triangle
- Save the file
|
|