. How to implement color cursor, animated cursor and custom cursor in net

Source: Internet
Author: User
Tags custom cursors

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.