Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You have two basic options:</p> <ol> <li><p>When the mouse cursor is over your control, hide the system cursor by setting <code>this.Cursor = Cursors.None;</code> and draw your own cursor using whatever technique you like. Then, update the position and appearance of your cursor by responding to mouse events. Here are two examples:</p> <ul> <li><a href="http://www.xamlog.com/2006/07/17/creating-a-custom-cursor/" rel="noreferrer">http://www.xamlog.com/2006/07/17/creating-a-custom-cursor/</a></li> <li><a href="http://www.hanselman.com/blog/DeveloperDesigner.aspx" rel="noreferrer">http://www.hanselman.com/blog/DeveloperDesigner.aspx</a></li> </ul></li> <li><p>Create a new Cursor object by loading an image from a .cur or .ani file. You can create and edit these kinds of files in Visual Studio. There are also some free utilites floating around for dealing with them. Basically they're images (or animated images) which specify a "hot spot" indicating what point in the image the cursor is positioned at.</p></li> </ol> <p>If you choose to load from a file, note that you need an absolute file-system path to use the <code>Cursor(string fileName)</code> constructor. Lamely, <em>a relative path or Pack URI will not work.</em> If you need to load the cursor from a relative path or from a resource packed with your assembly, you will need to get a stream from the file and pass it in to the <code>Cursor(Stream cursorStream)</code> constructor. Annoying but true.</p> <p>On the other hand, specifying a cursor as a relative path when loading it using a XAML attribute <em>does</em> work, a fact you could use to get your cursor loaded onto a hidden control and then copy the reference to use on another control. I haven't tried it, but it should work.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload