public override void Render(GaugeGraphics g) { if (this.Common != null && base.Visible && this.GetScale() != null) { this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceStartRendering(this.Name)); g.StartHotRegion(this); this.GetScale().SetDrawRegion(g); RectangleF rectangleF = this.CalculateRangeRectangle(); CircularScale scale = this.GetScale(); double valueLimit = scale.GetValueLimit(this.StartValue); double valueLimit2 = scale.GetValueLimit(this.EndValue); float positionFromValue = scale.GetPositionFromValue(valueLimit); float positionFromValue2 = scale.GetPositionFromValue(valueLimit2); float num = positionFromValue2 - positionFromValue; if (Math.Round((double)num, 4) == 0.0) { g.RestoreDrawRegion(); g.EndHotRegion(); this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(this.Name)); } else { Pen pen = null; Brush brush = null; GraphicsPath graphicsPath = null; try { graphicsPath = g.GetCircularRangePath(rectangleF, (float)(positionFromValue + 90.0), num, this.StartWidth, this.EndWidth, this.Placement); if (graphicsPath == null) { g.RestoreDrawRegion(); g.EndHotRegion(); this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(this.Name)); return; } RectangleF rect = rectangleF; if (this.Placement != 0) { float num2 = this.StartWidth; if (num2 < this.EndWidth) { num2 = this.EndWidth; } if (this.Placement == Placement.Outside) { rect.Inflate(num2, num2); } else { rect.Inflate((float)(num2 / 2.0), (float)(num2 / 2.0)); } } RangeGradientType fillGradientType = base.FillGradientType; brush = g.GetCircularRangeBrush(rect, (float)(positionFromValue + 90.0), num, base.FillColor, base.FillHatchStyle, "", GaugeImageWrapMode.Unscaled, Color.Empty, GaugeImageAlign.TopLeft, fillGradientType, base.FillGradientEndColor); pen = new Pen(base.BorderColor, (float)base.BorderWidth); pen.DashStyle = g.GetPenStyle(base.BorderStyle); g.FillPath(brush, graphicsPath); if (base.BorderStyle != 0 && base.BorderWidth > 0) { g.DrawPath(pen, graphicsPath); } } catch (Exception) { if (graphicsPath != null) { graphicsPath.Dispose(); } if (pen != null) { pen.Dispose(); } if (brush != null) { brush.Dispose(); } g.RestoreDrawRegion(); throw; } this.Common.GaugeCore.HotRegionList.SetHotRegion(this, g.GetAbsolutePoint(this.GetScale().GetPivotPoint()), graphicsPath); g.RestoreDrawRegion(); g.EndHotRegion(); this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(this.Name)); } } }
internal override void Render(GaugeGraphics g) { if (Common == null || !base.Visible || GetScale() == null) { return; } Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceStartRendering(Name)); g.StartHotRegion(this); GetScale().SetDrawRegion(g); RectangleF rectangleF = CalculateRangeRectangle(); CircularScale scale = GetScale(); double valueLimit = scale.GetValueLimit(StartValue); double valueLimit2 = scale.GetValueLimit(EndValue); float positionFromValue = scale.GetPositionFromValue(valueLimit); float num = scale.GetPositionFromValue(valueLimit2) - positionFromValue; if (Math.Round(num, 4) == 0.0) { g.RestoreDrawRegion(); g.EndHotRegion(); Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(Name)); return; } Pen pen = null; Brush brush = null; GraphicsPath graphicsPath = null; try { graphicsPath = g.GetCircularRangePath(rectangleF, positionFromValue + 90f, num, StartWidth, EndWidth, Placement); if (graphicsPath == null) { g.RestoreDrawRegion(); g.EndHotRegion(); Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(Name)); return; } RectangleF rect = rectangleF; if (Placement != 0) { float num2 = StartWidth; if (num2 < EndWidth) { num2 = EndWidth; } if (Placement == Placement.Outside) { rect.Inflate(num2, num2); } else { rect.Inflate(num2 / 2f, num2 / 2f); } } RangeGradientType fillGradientType = base.FillGradientType; brush = g.GetCircularRangeBrush(rect, positionFromValue + 90f, num, base.FillColor, base.FillHatchStyle, "", GaugeImageWrapMode.Unscaled, Color.Empty, GaugeImageAlign.TopLeft, fillGradientType, base.FillGradientEndColor); pen = new Pen(base.BorderColor, base.BorderWidth); pen.DashStyle = g.GetPenStyle(base.BorderStyle); g.FillPath(brush, graphicsPath); if (base.BorderStyle != 0 && base.BorderWidth > 0) { g.DrawPath(pen, graphicsPath); } } catch (Exception) { graphicsPath?.Dispose(); pen?.Dispose(); brush?.Dispose(); g.RestoreDrawRegion(); throw; } Common.GaugeCore.HotRegionList.SetHotRegion(this, g.GetAbsolutePoint(GetScale().GetPivotPoint()), graphicsPath); g.RestoreDrawRegion(); g.EndHotRegion(); Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(Name)); }