Custom Cursor Using an Icon in Visual Basic 2012

Here's an example and some code options in using a custom cursor in an ".ico" format in Visual Basic 2012:

Customized cursor in run-time
Option 1:

Dim myIcon As Icon
Dim myCursor As Cursor

myIcon = New Icon("C:\myIconFileName.ico")
myCursor = New Cursor(myIcon.Handle)

Me.Cursor = myCursor


Option 2:


Dim myIcon As New Icon("C:\myIconFileName.ico")
Dim myCursor As New Cursor(myIcon.Handle)

Me.Cursor = myCursor


Option 3:

Dim myIcon As New Icon("C:\myIconFileName.ico")

Me.Cursor = New Cursor(myIcon.Handle)


Option 4:

Me.Cursor = New Cursor(New Icon("C:\myIconFileName.ico").Handle)


1 comment:

  1. Very nice. Keep on working more on this. I am sure there are others who are interested of this one.

    ReplyDelete