想要在改变鼠标光标,可是cursor类好像只支持单色的静态的文件。从网上下的*.cur,*.ani换上去全变成黑白的了,而且不会动。郁闷。
有没有直接改变鼠标光标的插件啊!
有没有直接改变鼠标光标的插件啊!
解决方案 »
- 【WPF】 textbox在输入文本时弹出一个靠右的popup,textbox和popup都有输入焦点,怎么做?
- 登陆VSS,提示unable to open user login file
- 一个关于actionscript 3.0的问题请问高手
- TextBox多行显示的话 ,如何加入回车
- 关于app.config的问题????
- 请帮我把这个C#代码转成C的!
- 请教!
- 关于NetworkStream 数据流问题
- 我熟悉Delphi,C/C++,对面向对象有足够的理解,现在为了适应潮流学习C#.net,请朋友们根据你们的经验和我的实际情况推荐一本好的书籍(中
- remoting的客户端如何安装?
- 数据库用户登录失败的问题
- GridView边框颜色问题!急!!!!
[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
[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");
}
}
}
.cur只支持黑白?
彩色的也可以!!楼主:
一个示例:
假设窗体名为Form1
using ....public class Form1:Form
{
....
//构造函数
public Form1
{
//设光标文件为:"D:\cursor\mycursor.ico" //网上有光标文件下载
.......
this.Cursor = new Cursor("D:\cursor\mycursor.ico");
}
....
}
彩色的.cur载入好象有问题,没成功过
.ico倒是没问题