当我使用a 从资源文件MemoryStream加载a时Cursor,我会收到一个ArgumentException.这是我用来加载游标的代码:
Cursor myCursor
= new Cursor(new MemoryStream(WaterforMGC.Properties.Resources.waterspray));
Cursor = myCursor;
Run Code Online (Sandbox Code Playgroud)
但是我得到了错误.我不知道出了什么问题,我甚Cursor = myCursor;至改变了 this.Cursor = myCursor;给了我同样的错误.我试过了,gameform.Cursor = myCursor;但根本没用.
System.ArgumentException: Image format is not valid. The image file may be corrupted. Parameter name: stream ---> System.Runtime.InteropServices.COMException (0x800A01E1): Exception from HRESULT: 0x800A01E1 (CTL_E_INVALIDPICTURE) at System.Windows.Forms.UnsafeNativeMethods.IPersistStream.Load(IStream pstm) at System.Windows.Forms.Cursor.LoadPicture(IStream stream) --- End of inner exception stack trace --- at System.Windows.Forms.Cursor.LoadPicture(IStream stream) at WaterforMGC.gameform.Form1_Load(Object sender, EventArgs e) in C:\Users\Jan\Documents\Visual Studio 2008\Projects\WaterforMGC\WaterforMGC\Form1.cs:line 39 …