2014-01-20 34 views
0

如何为我的应用程序制作自定义光标?我如何在(C#)中制作自定义光标

这是我的光标:

Custom Cursor

我的实际脚本:

public BasePreview() 
{ 
    InitializeComponent(); 
    Bitmap bitmap = global::testCursor.Properties.Resources.Cursor1; 
    Cursor cursor = new System.Windows.Forms.Cursor(bitmap.GetHbitmap()); 
    this.Cursor = cursor; 
} 

问题:

将鼠标悬停在该程序。所以我的光标看起来像waitCursor。你能帮我吗?

回答

0
System.IO.MemoryStream cursorMemoryStream = new System.IO.MemoryStream(Properties.Resources.Cursor1); 
Cursor mCursor = new Cursor(cursorMemoryStream); 
this.Cursor = mCursor; 
+1

错误: 错误\t \t 2参数1:不能从 '字串' 到 'testCursor.Cursor' 错误转换\t \t 3无法隐式转换类型 'testCursor.Cursor' 到“System.Windows.Forms的.Cursor 错误\t \t 1为最好重载方法匹配 'testCursor.Cursor.Cursor(testCursor.Cursor)' 具有一些无效参数 –

+0

和我用这样的: 光标mCursor =新的光标( “Cursor.cur”); this.Cursor = mCursor; –

+0

编辑答案现在检查。 – Sameer