Problems with an unmanaged DLL
Posted: Wed Jul 05, 2006 2:25 pm
Here is a description of the problem:
I placed a tchart NET control on a form and did not change any of the default properties (no series added at all).
When I start a connection with an industrial acquisition device (that has a software support in the form of an unmanaged DLL that manages a FIFO data structure) in the same thread (the application has only one thread) at the first repaint of the tchart (i.e. when moving the mouse cursor over it) I get this exception:
Overflow or underflow during arithmetic operation.
at System.Drawing.Font.Initialize(FontFamily family, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont)
at System.Drawing.Font.Initialize(String familyName, Single emSize, FontStyle style, GraphicsUnit unit)
at System.Drawing.Font..ctor(String familyName, Single emSize, FontStyle style)
at Steema.TeeChart.Drawing.ChartFont.get_DrawingFont()
at Steema.TeeChart.Drawing.Graphics3DGdiPlus.MeasureString(ChartFont f, String text)
at Steema.TeeChart.Drawing.Graphics3D.TextHeight(String text)
at Steema.TeeChart.Drawing.Graphics3D.get_FontHeight()
at Steema.TeeChart.Title.Draw(Graphics3D g, Rectangle& rect)
at Steema.TeeChart.Title.DoDraw(Graphics3D g, Rectangle& rect, Boolean CustomOnly)
at Steema.TeeChart.Chart.DrawTitleFoot(Rectangle& rect, Boolean CustomOnly)
at Steema.TeeChart.Chart.DrawTitlesAndLegend(Graphics g, Rectangle& tmp, Boolean BeforeSeries)
at Steema.TeeChart.Chart.InternalDraw(Graphics g)
at Steema.TeeChart.TChart.Draw(Graphics g)
at Steema.TeeChart.TChart.OnPaint(PaintEventArgs pe)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.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.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMess Il programma "[3476] Prototype.exe" è terminato con il codice 0 (0x0).
ageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Prototype.Main.main() in C:\sviluppo\Working\Studio\Prototype\Prototype\Main.vb:line 5
I think that the unmanaged DLL provided with the acquisition device uses memory in a way that confilcts with the tchart.
Do someone has any suggestion to fix this problem?
Is it possible to create a derived class of tChart redefining the paint event handler in order to trap this error (leaving any other property/method unthouched)? If so, can you give me an example that does this in vb.NET (which class and method do I have to inherit from and to override)?
Thanks to everyone for your help
I placed a tchart NET control on a form and did not change any of the default properties (no series added at all).
When I start a connection with an industrial acquisition device (that has a software support in the form of an unmanaged DLL that manages a FIFO data structure) in the same thread (the application has only one thread) at the first repaint of the tchart (i.e. when moving the mouse cursor over it) I get this exception:
Overflow or underflow during arithmetic operation.
at System.Drawing.Font.Initialize(FontFamily family, Single emSize, FontStyle style, GraphicsUnit unit, Byte gdiCharSet, Boolean gdiVerticalFont)
at System.Drawing.Font.Initialize(String familyName, Single emSize, FontStyle style, GraphicsUnit unit)
at System.Drawing.Font..ctor(String familyName, Single emSize, FontStyle style)
at Steema.TeeChart.Drawing.ChartFont.get_DrawingFont()
at Steema.TeeChart.Drawing.Graphics3DGdiPlus.MeasureString(ChartFont f, String text)
at Steema.TeeChart.Drawing.Graphics3D.TextHeight(String text)
at Steema.TeeChart.Drawing.Graphics3D.get_FontHeight()
at Steema.TeeChart.Title.Draw(Graphics3D g, Rectangle& rect)
at Steema.TeeChart.Title.DoDraw(Graphics3D g, Rectangle& rect, Boolean CustomOnly)
at Steema.TeeChart.Chart.DrawTitleFoot(Rectangle& rect, Boolean CustomOnly)
at Steema.TeeChart.Chart.DrawTitlesAndLegend(Graphics g, Rectangle& tmp, Boolean BeforeSeries)
at Steema.TeeChart.Chart.InternalDraw(Graphics g)
at Steema.TeeChart.TChart.Draw(Graphics g)
at Steema.TeeChart.TChart.OnPaint(PaintEventArgs pe)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer, Boolean disposeEventArgs)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.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.ComponentManager.System.Windows.Forms.UnsafeNativeMethods+IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMess Il programma "[3476] Prototype.exe" è terminato con il codice 0 (0x0).
ageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Prototype.Main.main() in C:\sviluppo\Working\Studio\Prototype\Prototype\Main.vb:line 5
I think that the unmanaged DLL provided with the acquisition device uses memory in a way that confilcts with the tchart.
Do someone has any suggestion to fix this problem?
Is it possible to create a derived class of tChart redefining the paint event handler in order to trap this error (leaving any other property/method unthouched)? If so, can you give me an example that does this in vb.NET (which class and method do I have to inherit from and to override)?
Thanks to everyone for your help