想要在改变鼠标光标,可是cursor类好像只支持单色的静态的文件。从网上下的*.cur,*.ani换上去全变成黑白的了,而且不会动。郁闷。
有没有直接改变鼠标光标的插件啊!

解决方案 »

  1.   

    示例   
      [Visual   Basic,   C#,   C++]   下面的示例显示了一个窗体,该窗体通过使用   System.Windows.Forms.Cursor.#ctor   构造函数演示了自定义光标的用法。自定义   Cursor   嵌入在应用程序的资源文件中。该示例假定在名为   MyCursor.cur   的光标文件中包含有光标。要使用命令行编译该示例,请包括以下标志:/res:MyCursor.Cur,   CustomCursor.MyCursor.Cur     
      [Visual   Basic]     
      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   
      

  2.   

    http://msdn.microsoft.com/library/chs/default.asp?url=/library/CHS/cpref/html/frlrfsystemwindowsformscursorclassctortopic4.asp
    [C#] 
    using System;
    using System.Drawing;
    using System.Windows.Forms;namespace CustomCursor
    {
        public class Form1 : System.Windows.Forms.Form
        {
            [STAThread]
            static void Main() 
            {
                Application.Run(new Form1());
            }        public Form1()
            {
                this.ClientSize = new System.Drawing.Size(292, 266);
                this.Text = "Cursor Example";
                
                // 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
                //        
                //        Where "Namespace" is the namespace in which you want to use the cursor
                //        and   "CursorFileName.Cur" is the cursor filename.            // 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.
                this.Cursor = new Cursor(GetType(), "MyCursor.Cur");  
               
            }
        }
    }
      

  3.   

    SDK中的这个例子,楼上的编译过没有???
    .cur只支持黑白?
    彩色的也可以!!楼主:
    一个示例:
    假设窗体名为Form1
    using ....public class Form1:Form
    {
    ....
    //构造函数
    public Form1
    {
      //设光标文件为:"D:\cursor\mycursor.ico" //网上有光标文件下载
      .......
      this.Cursor = new Cursor("D:\cursor\mycursor.ico");
    }
    ....
    }
      

  4.   

    不好意思,楼上的楼上的,
    彩色的.cur载入好象有问题,没成功过
    .ico倒是没问题