Using system.drawing; using system.windows.forms; using system.runtime.interopservices; using system.reflection;
Namespace Colorcursor {/// /// This example The effect: /// Implement color cursor, animation cursor, and custom cursor in .NET. /// summary> public class Form1: System.Windows.Forms.Form {[DllImport ( "user32.dll")] public static extern IntPtr LoadCursorFromFile (string fileName); [DllImport ( "user32.dll")] public static extern IntPtr SetCursor (IntPtr cursorHandle); [DllImport ( "user32.dll")] public static extern uint DestroyCursor (IntPtr cursorHandle); [STAThread] static void Main () {Application.Run (new Form1 ());} public Form1 () {this.text = "Welcome"; cursor mycursor = new cursor (curRrent.handle); //dinosau2.ani As a cursor comes with Windows: INTPTR ColorcursorHandle = loadingCursorfromFile (@ "C: / Winnt / Cursors /dinosau2.ani ".); myCursor.GetType () InvokeMember (" handle ", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetField, null, myCursor, new object [] {colorCursorHandle}); this. Cursor = mycursor;}}}