【问题标题】:Rectangle '{X=0,Y=19,Width=0,Height=-19}' cannot have a width or height equal to 0矩形 '{X=0,Y=19,Width=0,Height=-19}' 的宽度或高度不能等于 0
【发布时间】:2016-11-28 10:59:13
【问题描述】:

无中生有,我得到了这个错误:

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)


注意事项:
+ 我在 Visual Studio 2005 中使用 VB.Net 和 Infragistics。
+ 单击另一个选项卡时出现错误。
+ 如果我使用 F5 调试或不使用调试器运行,则会出现错误,但如果我使用 F10 和断点进行调试,则不会出现。
+ 我已经搜索了 .designer.vb 文件(27000+ 代码行!)但没有找到任何线索。
+ 在另一个 .designer.vb 文件中,我尝试通过在 Rectangle 实例中输入 0 和负数作为宽度和高度参数来重现错误,然后运行程序。错误未出现。

这个错误已经困扰我好几天了。

有人能指出根本原因和解决方案吗?
请帮助,并提前致谢。

【问题讨论】:

  • 某事与您的 UltraTabPageControl 相关。您应该发布 UltraTabControl 的事件处理程序的代码(如果有)
  • 另外,UltraTabControl 的自定义属性页有一个选项,只显示修改后的属性。您可以开始将这些属性重置为其默认值,直到您的选项卡再次开始工作。
  • 感谢您的回答。据我所知, UltraTabControl 没有事件处理程序。以及如何重置这些属性?

标签: .net vb.net infragistics


【解决方案1】:

在我将用户控件的属性 MaximumSize 更改为 2000,2000(以前是 0,0)后,错误消失了。这更像是解决方法,我还没有发现它是如何工作的,因为其他用户控件的 MaximumSize(s) 也是 0,0 但它们可以正常工作而没有错误。

【讨论】:

    猜你喜欢
    • 2020-03-11
    • 1970-01-01
    • 2020-01-08
    • 1970-01-01
    • 1970-01-01
    • 2020-03-05
    • 2014-01-24
    • 2014-11-09
    • 1970-01-01
    相关资源
    最近更新 更多