我在我的C#.net win表單應用程序中遇到以下異常。如何解決winforms錯誤「GDI +中發生了一般性錯誤。」?
GDI +發生了一般性錯誤。
在System.Drawing.Graphics.CheckErrorStatus(的Int32狀態)
在System.Drawing.Graphics.DrawRectangle(筆筆,的Int32的x,的Int32 Y,的Int32寬度,高度的Int32)
在WeifenLuo.WinFormsUI.Docking.DockWindow .OnPaint(PaintEventArgs的E)
在System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs的E,Int16的層,布爾disposeEventArgs)
在System.Windows.Forms.Control.WmPaint(消息&米)
在系統。 Windows.Forms.Control.WndProc(Message & m)
at System.Windows.Forms.ScrollableControl.WndProc(消息&米)
在System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息&米)
在System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息&米)
在System.Windows.Forms的.NativeWindow.Callback(IntPtr的的HWND,味精的Int32,IntPtr的WPARAM,LPARAM的IntPtr)
最令人困惑的一點是,它很少發生,當應用程序加載表單(其中包含了一些豐富的圖形,WPF工作等等),可以說大約90%的時間表單成功加載。但很少有這種情況發生,只有在某些機器上,在其他一些機器上,這種形式在100%的時間內工作,從不面臨這種例外情況。
我不明白爲什麼會發生這種異常,因爲它也沒有顯示導致異常的確切堆棧跟蹤。請建議您是否有任何關於如何處理它的想法。
錯誤也可能是由'g.DrawString(text,font,x,y);''x'或'y'值太大或太小造成的。 – Loathing 2015-11-28 21:32:29