Setting a Custom Cursor

It might be confusing to set a custom cursor for your form/control, due to the intellisense menu that appears when you are typing your code.

In the Visual Studio code editor, when you try to assign a custom cursor, you get a list of Cursors available. This is the Cursors enumeration and there is no Cursors.Custom or a similar member. This might confuse most of us.

customcursor

But it’s easy to set a custom cursor. You can create an instance of Cursors class and assign it to the form’s/control’s Cursor property

e.g.

Me.Cursor = New Cursor("C:\mycursor.cur")

You may use one of the other overloads if your cursor image is not in a disk file. e.g. a resource etc.

There are just a few properties in .NET like this, that are overloaded in this way to accept either an enum member or a class instance.

I couldn’t figure out any way to set a custom cursor at design time. I tried to look up the MSDN about this, but failed. If anyone knows a good way to set a custom cursor at design time, I’ll be glad to hear.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: