我把一个光标文件“hand.cur”,以文件的方式添加进了资源中,资源中的名称为“hand”
想把系统光标设置成我想要的光标代码如下:public const int OCR_NORMAL = 32512;
int hFile = LoadCursorFromFile(Resource1.hand);
SetSystemCursor(hFile, OCR_NORMAL); 不成功!想问下怎样才能从资源文件中设置系统光标?
对于资源文件中 以文件类型存入的文件怎样使用?
想把系统光标设置成我想要的光标代码如下:public const int OCR_NORMAL = 32512;
int hFile = LoadCursorFromFile(Resource1.hand);
SetSystemCursor(hFile, OCR_NORMAL); 不成功!想问下怎样才能从资源文件中设置系统光标?
对于资源文件中 以文件类型存入的文件怎样使用?
System.Reflection.Assembly.GetExecutingAssembly();
System.IO.Stream f = assembly.GetManifestResourceStream("WindowsApplication1.hand.cur");
Cursor cur = new Cursor(f);
f.Close();
SetSystemCursor(cur.Handle, OCR_NORMAL);
我的电脑没上网,在网吧上的!
运行这段代码,为什么提示 f 为 null呢!
是把图标放在 项目资源中的!
最后通过把图标放在 string 资源中,成功设置成鼠标了,为什么直接从资源中读cur就不行!另外cur.Handle 是PtrInt吧,应该改成 SetSystemCursor((int)cur.Handle, OCR_NORMAL);吧
还是要改api的声明!