cursor keeps resetting ?

  • Thread starter Thread starter ilPostino
  • Start date Start date
I

ilPostino

I'm using this function to load a custom cursor from a .cur file;

public static extern IntPtr LoadCursorFromFile(String str);

It works great but if I popup a ContextMenu or Control like a ListView, the
cursor resets to the system arrow. Even if I set the cursor property of each
control to the one loaded it just ignores it.

The ContextMenu doesn't support a cursor property either.

Is there maybe a win32api function to set the cursor of a Handle?



thanks

postie
 
I had a similar cursor problem trying to get the wait cursor to show. What I
did for that was to set the cursor in my OnPaint() routine so that it was
the last thing done when the screen was updated for whatever reason.

In my case it was setting it to Cursor = Cursors.WaitCursor; at the start of
the paint routine - and or any other lengthy routine and then setting it
back with Cursor=Cursors.Default; at the very end of OnPaint(). Your problem
is the opposite so I guess if you set the cursor to your new cursor at the
end of OnPaint then this will do the trick.

It will mean that you get the arrow cursor during a context menu etc but
this is probably what you want anyway.

Ray
 
Back
Top