Custom Colour Cursor

  • Thread starter Thread starter Paul Cheetham
  • Start date Start date
P

Paul Cheetham

Hi,

I have several Colour custom cursors embedded in my application resource.
In order to load and use them I use the following function:

public static Cursor LoadCursor (string CursorName)
{
Cursor myCursor;
Stream cursorStream;
Assembly thisAssembly;
String Name;

thisAssembly = Assembly.GetEntryAssembly();
Name = "ProLogic.Cursors." + CursorName + ".CUR";
cursorStream = thisAssembly.GetManifestResourceStream(Name);
myCursor = new Cursor(cursorStream);

cursorStream.Close();

return (myCursor);
}


This loads the cursor, but only in Mono.
Does anyone know how I can get the cursor to display in colour as it was
designed?

Thankyou.

Paul.
 
Per the documentation, the Cursor class does not support
..ani cursors or color cursors. It only supports black and white.

You need to use interop P-Invoke LoadImage exported from user32.dll
to load the cursor from your resource.
 
Michael said:
Per the documentation, the Cursor class does not support
.ani cursors or color cursors. It only supports black and white.

You need to use interop P-Invoke LoadImage exported from user32.dll
to load the cursor from your resource.

Hmmm.... Seems like a step backwards.
Presumably I can use the Win32 LoadCursor function which gives me an
HCursor.

Is there then a way to assign this to the cursor class?


Thanks.


Paul
 
The Cursor class has a constructor that can be used
with the HCURSOR (IntPtr) handle.
 
Back
Top