Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
519
"Parameter is not valid" exception in OnPaint() in Ultragrid
posted

Hi ,

I am getting Parameter is not valid exception while calling onPaint(). 

 base.OnPaint(pe);

 

There are multiple grid using a custorm grid which is calling this method.

I am resetting the grid layout for all the grids with the help of LoadFromXml() , which causes a call to onpaint() .

When i check the parameters , i see

X and Y are 0,0 ...not sure if this is the cause.

Stack Trace is somthing like this :

System.ArgumentException: Parameter is not valid.
   at System.Drawing.Image.get_Width()
   at Infragistics.Win.UltraWinScrollBar.ScrollThumbUIElement.DrawImage(UIElementDrawParams& drawParams)
   at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)
   at Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)
   at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)
   at Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)
   at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)
   at Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)
   at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)
   at Infragistics.Win.UIElement.DrawChildElements(UIElementDrawParams& drawParams)
   at Infragistics.Win.UIElement.DrawElement(UIElementDrawParams& defaultDrawParams)
   at Infragistics.Win.UIElement.DrawHelper(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Boolean clipText, Boolean forceDrawAsFocused, Boolean preventAlphaBlendGraphics)
   at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode, Size elementSize, Boolean preventAlphaBlendGraphics)
   at Infragistics.Win.ControlUIElementBase.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode)
   at Infragistics.Win.UltraWinGrid.UltraGridUIElement.Draw(Graphics graphics, Rectangle invalidRectangle, Boolean doubleBuffer, AlphaBlendMode alphaBlendMode)
   at Infragistics.Win.UltraControlBase.OnPaint(PaintEventArgs pe)
   at Infragistics.Win.UltraWinGrid.UltraGrid.OnPaint(PaintEventArgs pe)
   at Grid.OnPaint(PaintEventArgs pe) in 325
   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.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)

 Thanks,
Ashish.

  • 469350
    Offline posted

    Hi Ashish,

    What version of the grid are you using? Do you have the latest service release?

    How to get the latest service release - Infragistics Community

     

    Exactly what X and Y parameters are you referring to? I doubt that any X or Y would have anything to do with this exception. Most likely, this is either a bug in the grid, a threading issue in your application, or you are trying to use an image in the grid and that image was disposed for some reason.

    Can you duplicate this exception in a small sample project?