Image format is not valid. The image file may be corrupted in win7

元气小坏坏 提交于 2021-01-29 08:14:55

问题


i am making a WinForms using .NET Framework 4.8

i am using custom cursor by add in Resources

and using curser by this code

txt_Groub_Code.Cursor = new Cursor(new MemoryStream(Properties.Resources.Search_Cursor));

After it was Copy clint it's work fine in windows 10

but in windows 7 i get this Error

System.ArgumentException: Image format is not valid. The image file may be corrupted.
Parameter name: stream ---> System.Runtime.InteropServices.COMException: 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 System.Windows.Forms.Cursor..ctor(Stream stream)
   at PayRoll.Basis.frmEmployeeData.Show_Curosr_Search() in C:\Users\Ahmed Abdo\Desktop\WorkNow\PayRoll\PayRoll\PayRoll\Basis\frmEmployeeData.cs:line 60
   at PayRoll.Basis.frmEmployeeData.Clear_And_Show() in C:\Users\Ahmed Abdo\Desktop\WorkNow\PayRoll\PayRoll\PayRoll\Basis\frmEmployeeData.cs:line 582
   at PayRoll.Basis.frmEmployeeData.frmEmployeeData_Load(Object sender, EventArgs e) in C:\Users\Ahmed Abdo\Desktop\WorkNow\PayRoll\PayRoll\PayRoll\Basis\frmEmployeeData.cs:line 593
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

how can fixed this Error????

来源:https://stackoverflow.com/questions/64432179/image-format-is-not-valid-the-image-file-may-be-corrupted-in-win7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!