data bound grid displays 'Exception' in red in a cell when cell value is large. Want to handle it my self and display a truncated string in stead of 'Exception'. Any suggestions would be appreciated.
Following is the exception stack.
System.Runtime.InteropServices.ExternalException was unhandled
Message="A generic error occurred in GDI+."
Source="System.Drawing"
ErrorCode=-2147467259
StackTrace:
at System.Drawing.Graphics.MeasureString(String text, Font font, SizeF layoutArea, StringFormat stringFormat)
at System.Drawing.Graphics.MeasureString(String text, Font font, Int32 width, StringFormat format)
at Syncfusion.Windows.Forms.Grid.GridStaticCellModel.OnQueryPrefferedClientSize(Graphics g, Int32 rowIndex, Int32 colIndex, GridStyleInfo style, GridQueryBounds queryBounds)
at Syncfusion.Windows.Forms.Grid.GridCellModelBase.CalculatePreferredCellSize(Graphics g, Int32 rowIndex, Int32 colIndex, GridStyleInfo style, GridQueryBounds queryBounds)
at Syncfusion.Windows.Forms.Grid.GridModelColWidthsIndexer.ResizeToFit(GridRangeInfo range, GridResizeToFitOptions options)
at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.ResizeVisibleRowsToFit(Boolean force)
at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.ResizeVisibleRowsToFit()
at Syncfusion.Windows.Forms.Grid.GridDataBoundGrid.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.Control.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.Form.OnVisibleChanged(EventArgs e)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at CyberSecure.InitialFlow.showForm(Form frm) in S:\cc\532\cc\src\csharp\CyberSecure\ConfigTool\InitialFlow.cs:line 3075
at CyberSecure.InitialFlow.ccAuditTrail_Click(Object sender, EventArgs e) in S:\cc\532\cc\src\csharp\CyberSecure\ConfigTool\InitialFlow.cs:line 2300
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.MenuStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at CyberSecure.AppMain.Main(String[] Args) in S:\cc\532\cc\src\csharp\CyberSecure\ConfigTool\AppMain.cs:line 91
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: