Well, as the title says, how can I set an image or anything else as the mouse cursor. I know you can use the built in ones that are part of the Cursors class, but I was wondering if there's a way to use your own image (preferably without P/Invoke, but either way is fine.)
EDIT: I guess I didn't explain what I wanted clearly enough. I don't have any .cur files (are they easy to create?), I want to know if there's a way to take an image from disk (or wherever) and use that as the cursor. Ultimatley what I'd like would be to do something like this:
myForm.Cursor = new Cursor(Image.FromFile("foo.jpg"));
Possible?
Step 1: Navigate to the Mouse properties window as we did earlier. Step 2: Select the Pointers tab. Step 3: To select a custom cursor for the highlighted individual icon, click Browse. Step 4: That will open the default cursors folder, where hundreds of different cursor options are available.
Open Control Panel | Appearance and Personalization | Personalization | Change mouse pointers.
A cursor in Windows is an icon that is displayed when you move a mouse, a pen, or a trackball. This code shows how to apply and manage cursors in your Windows applications. A cursor in Windows is an icon that is displayed when you move a mouse, a pen, or a trackball.
At the simplest, you just use:
form.Cursor = new Cursor(path);
But there are overloads to load from other sources (an unmanaged pointer, a raw stream, or a resx).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With