如何在(C#)中创建自定义光标
如何为我的应用程序定制光标 这是我的光标:如何在(C#)中创建自定义光标,c#,forms,bitmap,cursor,C#,Forms,Bitmap,Cursor,如何为我的应用程序定制光标 这是我的光标: public BasePreview() { InitializeComponent(); Bitmap bitmap = global::testCursor.Properties.Resources.Cursor1; Cursor cursor = new System.Windows.Forms.Cursor(bitmap.GetHbitmap()); this.Cursor = cursor; } 我的脚本:
public BasePreview()
{
InitializeComponent();
Bitmap bitmap = global::testCursor.Properties.Resources.Cursor1;
Cursor cursor = new System.Windows.Forms.Cursor(bitmap.GetHbitmap());
this.Cursor = cursor;
}
我的脚本:
public BasePreview()
{
InitializeComponent();
Bitmap bitmap = global::testCursor.Properties.Resources.Cursor1;
Cursor cursor = new System.Windows.Forms.Cursor(bitmap.GetHbitmap());
this.Cursor = cursor;
}
问题:
public BasePreview()
{
InitializeComponent();
Bitmap bitmap = global::testCursor.Properties.Resources.Cursor1;
Cursor cursor = new System.Windows.Forms.Cursor(bitmap.GetHbitmap());
this.Cursor = cursor;
}
将鼠标悬停在程序上。所以我的光标看起来像waitCursor。您能帮助我吗?错误:错误2参数1:无法从“字符串”转换为“testCursor.Cursor”错误3无法将类型“testCursor.Cursor”隐式转换为“System.Windows.Forms.Cursor”错误1与“testCursor.Cursor”(testCursor.Cursor)最匹配的重载方法'有一些无效参数,我使用了这个:Cursor mCursor=new Cursor(“Cursor.cur”);this.Cursor=mCursor;编辑答案检查现在。
System.IO.MemoryStream cursorMemoryStream = new System.IO.MemoryStream(Properties.Resources.Cursor1);
Cursor mCursor = new Cursor(cursorMemoryStream);
this.Cursor = mCursor;