Please run the attached sample project and follow the steps illustrated in the attached gif file. The following exception occurs:
System.ArgumentException
HResult=0x80070057
Message=Rectangle '{X=0,Y=35,Width=156.3333,Height=0}' cannot have a width or height equal to 0.
Source=System.Drawing
StackTrace:
at System.Drawing.Drawing2D.LinearGradientBrush..ctor(RectangleF rect, Color color1, Color color2, Single angle, Boolean isAngleScaleable)
at System.Drawing.Drawing2D.LinearGradientBrush..ctor(RectangleF rect, Color color1, Color color2, Single angle)
at Telerik.WinControls.UI.Gauges.LinearGaugeBrushFactory.CreateBrush(GaugeVisualElement owner, GaugeBrushType type)
at Telerik.WinControls.UI.Gauges.LinearGaugeBar.Paint(Graphics graphics, Rectangle boundingRectangle)
at Telerik.WinControls.UI.Gauges.LinearGaugeBar.PaintElement(IGraphics graphics, Single angle, SizeF scale)
at Telerik.WinControls.RadElement.DoOwnPaint(IGraphics graphics, Single angle, SizeF scale)
at Telerik.WinControls.RadElement.Paint(IGraphics graphics, Rectangle clipRectangle, Single angle, SizeF scale, Boolean useRelativeTransformation)
at Telerik.WinControls.RadItem.PaintOverride(IGraphics screenRadGraphics, Rectangle clipRectangle, Single angle, SizeF scale, Boolean useRelativeTransformation)
at Telerik.WinControls.RadElement.PaintChild(RadElement child, IGraphics graphics, Rectangle clipRectange, Single angle, SizeF scale, Boolean useRelativeTransformation)
at Telerik.WinControls.RadElement.PaintChildren(IGraphics graphics, Rectangle clipRectange, Single angle, SizeF scale, Boolean useRelativeTransformation)
at Telerik.WinControls.VisualElement.PaintChildren(IGraphics graphics, Rectangle clipRectange, Single angle, SizeF scale, Boolean useRelativeTransformation)
at Telerik.WinControls.RadElement.Paint(IGraphics graphics, Rectangle clipRectangle, Single angle, SizeF scale, Boolean useRelativeTransformation)
at Telerik.WinControls.RadItem.PaintOverride(IGraphics screenRadGraphics, Rectangle clipRectangle, Single angle, SizeF scale, Boolean useRelativeTransformation)
at Telerik.WinControls.RadElement.PaintChild(RadElement child, IGraphics graphics, Rectangle clipRectange, Single angle, SizeF scale, Boolean useRelativeTransformation)
at Telerik.WinControls.RadElement.PaintChildren(IGraphics graphics, Rectangle clipRectange, Single angle, SizeF scale, Boolean useRelativeTransformation)
at Telerik.WinControls.VisualElement.PaintChildren(IGraphics graphics, Rectangle clipRectange, Single angle, SizeF scale, Boolean useRelativeTransformation)
at Telerik.WinControls.RadElement.Paint(IGraphics graphics, Rectangle clipRectangle, Single angle, SizeF scale, Boolean useRelativeTransformation)
at Telerik.WinControls.RadItem.PaintOverride(IGraphics screenRadGraphics, Rectangle clipRectangle, Single angle, SizeF scale, Boolean useRelativeTransformation)
at Telerik.WinControls.RadControl.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at Telerik.WinControls.RadControl.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.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
IMPORTANT: If both colors are changed at design time and you set the Value of RadLinearGauge to 0, this will provoke a similar error leading Visual Studio to crash.
Workaround: specify a minimum width/height for the gauge:
this.radLinearGauge1.MinimumSize = new Size(1, (int)this.linearGaugeBar1.Offset+1);