Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Are you sure that your cursor is the right format? Is it a plain 32x32, 1-bit non-animated cursor (created, for example, with the cursor editor in Visual Studio)? According to the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.cursor.aspx" rel="nofollow">documentation</a> the <code>Cursor</code> class only supports the most basic cursor format - animated / color cursors can only be loaded using the Windows API.</p> <p>I'm asking because I just created a new Windows Form project in VS 2012, added a new cursor, added the cursor to the resources and then used this code:</p> <pre><code>Cursor oC; using ( MemoryStream oMS = new MemoryStream ( Properties.Resources.Cursor1 ) ) { oC = new Cursor ( oMS ); this.Cursor = oC; } </code></pre> <p>This works just fine - no errors. (<code>this</code> is the form in the code above.)</p> <p>If your cursor is colored you can still embed it as a resource but you'll have to save it to disk first before loading it using <code>LoadCursorFromFile</code>. Don't save the cursor next to your executable - if it's not running from a user's profile folder, you may not have the necessary privileges to create a new file in that folder. Generate a temporary file name in the user's temporary folder (using <a href="http://msdn.microsoft.com/en-us/library/system.io.path.gettempfilename.aspx" rel="nofollow"><code>Path.GetTempFileName</code></a>) and save the cursor data there - once the cursor is loaded, you can delete the file.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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