Chnage to Custom Cursor

Hi, I need to change the mouse curor inside my .NET program

I dont want to use windows defaults. i want to use a custom cursor saved inside the program

please help.
LVL 15
Ess KayEntrapenuerAsked:
Who is Participating?
Alexandre SimõesConnect With a Mentor Manager / Technology SpecialistCommented:
From MSDN documentation:

Imports System
Imports System.Drawing
Imports System.Windows.Forms

Namespace CustomCursor
   Public Class Form1
      Inherits System.Windows.Forms.Form
      <System.STAThread()> _
      Public Shared Sub Main()
         System.Windows.Forms.Application.Run(New Form1())
      End Sub 'Main

      Public Sub New()

         Me.ClientSize = New System.Drawing.Size(292, 266)
         Me.Text = "Cursor Example"
         ' Looks namespace.MyCursor.cur in the assemblies manifest.
         ' The following generates a cursor from an embedded resource.
         ' To add a custom cursor, create or use an existing 16x16 bitmap
         '        1. Add a new cursor file to your project: 
         '                File->Add New Item->Local Project Items->Cursor File
         '        2. Select 16x16 image type:
         '                Image->Current Icon Image Types->16x16
         ' --- To make the custom cursor an embedded resource  ---
         ' In Visual Studio:
         '        1. Select the cursor file in the Solution Explorer
         '        2. Choose View->Properties.
         '        3. In the properties window switch "Build Action" to "Embedded"
         ' On the command line:
         '        Add the following flag:
         '            /res:CursorFileName.Cur,Namespace.CursorFileName.Cur
         ' The following line uses the namespace from the passed-in type
         ' and looks for CustomCursor.MyCursor.Cur in the assemblies manifest.
	 ' NOTE: The cursor name is acase sensitive.        
         Me.Cursor = New Cursor(Me.GetType(), "MyCursor.Cur") 
      End Sub 'New       
   End Class 'Form1
End Namespace 'CustomCursor

Open in new window

So the basic idea is to add the image to the project resources and then reference it.
Ess KayEntrapenuerAuthor Commented:
is that icon file able to take animation?>
Alexandre SimõesManager / Technology SpecialistCommented:
It should... Make it as an animated gif and it should be ok.
Ess KayEntrapenuerAuthor Commented:
i want to use downloaded cursors
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.