The example described in this paper mainly accomplishes the function of color cursor, animated cursor and custom cursor in dotnet. The following is a complete program instance that can be seen by command-line compilation to see how it works.
The Test.cs page code is as follows:
Using system;using system.drawing;using system.windows.forms;using system.runtime.interopservices;using System.reflection;namespace colorcursor{//<summary>/////////For this example:///Implement color cursors, animated cursors and custom cursors in. Net. </summary> public class Form1:System.Windows.Forms.Form {[DllImport (' user32.dll ')] public static extern intpt R 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 to" script House ": http://www.jb51.net/"; Cursor MyCursor = new cursor (Cursor.Current.Handle); Dinosau2.ani for Windows comes with the cursor: IntPtr colorcursorhandle = Loadcursorfromfile (@ "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; } }}
It is believed that the examples mentioned in this paper can help the C # program design of everyone.
In addition to the Declaration,
Running GuestArticles are original, reproduced please link to the form of the address of this article
. How to implement color cursor, animated cursor and custom cursor in net
This address: http://www.paobuke.com/develop/c-develop/pbk23650.html
Related content C # implementation of BASE64 encoding conversion of strings and pictures sample WinForm implementation of picture drag and zoom function Example C # 6.0 new features Summary C # Simple read-write TXT file method
C # How to obtain a cookie based on WebBrowser C # Simple implementation of a subform to a parent form method based on Fineui grid control Add right-click menu Async Socket Communication Programming Code instance in C #
. How to implement color cursor, animated cursor and custom cursor in net