Search code examples
.netvb.netinfragistics

Rectangle '{X=0,Y=19,Width=0,Height=-19}' cannot have a width or height equal to 0


Out of nothing, I get this error:

System.ArgumentException was unhandled
  Message="Rectangle '{X=0,Y=19,Width=0,Height=-19}' cannot have a width or height equal to 0."
  Source="System.Drawing"
  StackTrace:
       at System.Drawing.Drawing2D.LinearGradientBrush..ctor(Rectangle rect, Color color1, Color color2, LinearGradientMode linearGradientMode)
       at Infragistics.Win.DrawUtility.DrawBackColor(Control control, Graphics graphics, AppearanceData& appearanceData, Rectangle rect, Rectangle invalidRect, Boolean enabled, IDrawCache drawCache, AlphaBlendMode alphaBlendMode, Blend blend)
       at Infragistics.Win.DrawUtility.DrawBackColor(Control control, Graphics graphics, AppearanceData& appearanceData, Rectangle rect, Rectangle invalidRect, Boolean enabled, AlphaBlendMode alphaBlendMode)
       at Infragistics.Win.UltraWinTabControl.UltraTabPageControl.PaintBackground(PaintEventArgs e)
       at Infragistics.Win.UltraWinTabControl.UltraTabPageControl.OnPaintBackground(PaintEventArgs e)
       at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle, Region transparentRegion)
       at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle)
       at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle, Color backColor, Point scrollOffset)
       at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle)
       at System.Windows.Forms.Control.OnPaintBackground(PaintEventArgs pevent)
       at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle, Region transparentRegion)
       at System.Windows.Forms.Control.PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle)
       at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle, Color backColor, Point scrollOffset)
       at System.Windows.Forms.Control.PaintBackground(PaintEventArgs e, Rectangle rectangle)
       at System.Windows.Forms.Control.OnPaintBackground(PaintEventArgs pevent)
       at System.Windows.Forms.ScrollableControl.OnPaintBackground(PaintEventArgs e)
       at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
       at System.Windows.Forms.Control.WmEraseBkgnd(Message& m)
       at System.Windows.Forms.Control.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)


Notes:
+ I use VB.Net & Infragistics in Visual Studio 2005.
+ the error appears when clicking another tab.
+ the error appears if I debug with F5 or run without debugger, but does NOT appear if I debug using F10 & breakpoints.
+ I have searched the .designer.vb file (27000+ codelines!) but found no clue.
+ in another .designer.vb file, I tried to reproduce the error by inputting 0 and negative numbers as width & height parameters in a Rectangle instantiation then ran the program. the error does NOT appear.

This error has been bugging me for days.

Could somebody point out the root cause and solution?
Please help, and thanks in advance.


Solution

  • error disappeared after I changed the User Control's property MaximumSize to 2000,2000 (previously 0,0). this is more like workaround and I haven't found out how that works, since other User Controls' MaximumSize(s) are also 0,0 yet they work fine without error.