X - How to fix error "A generic error occurred in GDI+"?
Hi,
I got this error when dragging the scrollbar downwards to row: 7000, (sfdatagrid has 9000 rows), what does it mean? how do i fix it? (I don't use any redraw events (drawcell, cellrender ..))
A generic error occurred in GDI+.
************** Exception Text **************
System.Runtime.InteropServices.ExternalException (0x80004005): A generic error occurred in GDI+.
at System.Drawing.Graphics.CheckErrorStatus(Int32 status)
at System.Drawing.Graphics.DrawString(String s, Font font, Brush brush, RectangleF layoutRectangle, StringFormat format)
at Syncfusion.WinForms.DataGrid.Renderers.GridCellRendererBase.OnRender(Graphics paint, Rectangle cellRect, String cellValue, CellStyleInfo style, DataColumnBase column, RowColumnIndex rowColumnIndex)
at Syncfusion.WinForms.DataGrid.Renderers.GridTextBoxCellRenderer.OnRender(Graphics paint, Rectangle cellRect, String cellValue, CellStyleInfo style, DataColumnBase column, RowColumnIndex rowColumnIndex)
at Syncfusion.WinForms.DataGrid.Renderers.GridCellRendererBase.Render(Graphics paint, Rectangle cellRect, String cellValue, CellStyleInfo style, DataColumnBase column, RowColumnIndex rowColumnIndex)
at Syncfusion.WinForms.DataGrid.GridPainter.DrawCell(Graphics graphics, Rectangle rect, DataColumnBase column, Object cellValue, String formattedText)
at Syncfusion.WinForms.DataGrid.GridPainter.DrawColumn(Graphics graphics, Rectangle finalSize, DataRowBase dataRow, IEnumerable`1 columns)
at Syncfusion.WinForms.DataGrid.GridPainter.DrawDefaultRow(Graphics graphics, DataRowBase dataRow, Rectangle finalSize)
at Syncfusion.WinForms.DataGrid.GridPainter.DrawRow(DataRowBase dataRow, Rectangle finalSize, Graphics graphics)
at Syncfusion.WinForms.DataGrid.GridPainter.DrawRows(Graphics graphics)
at Syncfusion.WinForms.DataGrid.GridPainter.OnPaint(PaintEventArgs e, Size clientSize)
at Syncfusion.WinForms.DataGrid.TableControl.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at Syncfusion.WinForms.Controls.SfScrollControl.WndProc(Message& msg)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
SIGN IN To post a reply.
8 Replies
SS
Susmitha Sundar
Syncfusion Team
June 22, 2020 03:52 PM UTC
Hi khanh dang,
Thank you for using Syncfusion controls.
We need more information to analyze you reported scenario. Can you please provide below things?
1. SfDataGrid settings
2. Column generation code.
3. Which type of form you are using?
4. Syncfusion version.
It will be helpful for us to check on it and provide you the solution at the earliest.
Regards,
Susmitha S
TG
The GridLock
June 23, 2020 02:28 AM UTC
Hi susmitha,
Not sure but maybe some cells contain strings that are too long, after removing them the problem has been fixed for me.
SS
Susmitha Sundar
Syncfusion Team
June 23, 2020 02:47 PM UTC
Hi khanh dang,
Thanks for the update.
We have checked the reported issue “Scrolling throws the exception” with long text. But we could not replicate the same. Please refer the below sample,
Sample link: https://www.syncfusion.com/downloads/support/directtrac/155392/ze/DataGridDemo-527822294
Please check the sample and let us know, if you still facing the same issue? If not, please modify the sample based on your scenario and revert us back with following details,
1. Provide Syncfusion updated version
SfDataGrid settings
It will be helpful for us to check on it and provide you the solution at the earliest.
Regards,
Susmitha S
Susmitha S
TG
The GridLock
June 23, 2020 09:12 PM UTC
Hi Susmitha,
For the time being, I cannot see it yet. I will recreate the file when I can.
SS
Susmitha Sundar
Syncfusion Team
June 24, 2020 06:49 AM UTC
Hi khanh dang,
Thanks for the update.
We will wait to hear from you.
Regards,
Susmitha S
KK
Kim Kamper
August 1, 2020 02:28 PM UTC
Hi: I am getting the same error. I have a DataTable with 175,000 records, with one of the fields being OCR text. I am using an OrderInfoCollection as the DataSource for the sfDataGrid control.
The sfDataGrid control was loading and populating just fine before I started adding text to the OCR field. Many of the OCR text fields have a length of over 40,000 characters at this time (will be reducing the length of characters in this field soon).
So... I am very interested in what is causing this error, and the way to solve it. Please keep me informed on this error.
Thanks!
MA
Mohanram Anbukkarasu
Syncfusion Team
August 3, 2020 03:01 PM UTC
Hi Kim,
Thanks for the update.
We are able to reproduce the reported issue when the length of any value of a cell has 40,000 characters. On analysis we found that the issue occurs from the Graphics.DrawString method which we have used to draw the cell values. This can be reproduced in a simple windows application as given below.
Sample link : https://www.syncfusion.com/downloads/support/directtrac/general/ze/DrawStringDemo229411122
We have raised a query regarding this in developers community.
Developer’s community query link : https://developercommunity.visualstudio.com/content/problem/1134457/graphicsdrawstring-method-throws-gdi-exception-whe.html
We will update with further details once we get any prompt solution for this query. We appreciate your patience.
Regards,
Mohanram A.
SIGN IN To post a reply.
- 8 Replies
- 4 Participants
-
TG The GridLock
- Jun 22, 2020 12:38 AM UTC
- Aug 3, 2020 03:01 PM UTC