public GraphicsPath GetPointerPath(GaugeGraphics g) { if (!this.Visible) { return(null); } GraphicsPath graphicsPath = new GraphicsPath(); ScaleBase scale = this.GetScale(); scale.GetPositionFromValue(scale.GetValueLimit(base.Position)); if (this.Type == LinearPointerType.Marker || this.Image != string.Empty) { MarkerStyleAttrib markerStyleAttrib = this.GetMarkerStyleAttrib(g); if (markerStyleAttrib.path != null) { graphicsPath.AddPath(markerStyleAttrib.path, false); } } else if (this.Type == LinearPointerType.Bar) { BarStyleAttrib barStyleAttrib = this.GetBarStyleAttrib(g); if (barStyleAttrib.primaryPath == null) { graphicsPath.Dispose(); return(null); } if (barStyleAttrib.primaryPath != null) { graphicsPath.AddPath(barStyleAttrib.primaryPath, false); } } else if (this.Type == LinearPointerType.Thermometer) { BarStyleAttrib thermometerStyleAttrib = this.GetThermometerStyleAttrib(g); if (thermometerStyleAttrib.primaryPath == null) { graphicsPath.Dispose(); return(null); } if (thermometerStyleAttrib.totalPath != null) { graphicsPath.AddPath(thermometerStyleAttrib.primaryPath, false); } } return(graphicsPath); }
public MarkerStyleAttrib GetMarkerStyleAttrib(GaugeGraphics g) { MarkerStyleAttrib markerStyleAttrib = new MarkerStyleAttrib(); float absoluteDimension = g.GetAbsoluteDimension(this.MarkerLength); float absoluteDimension2 = g.GetAbsoluteDimension(this.Width); markerStyleAttrib.path = g.CreateMarker(new PointF(0f, 0f), absoluteDimension2, absoluteDimension, this.MarkerStyle); float num = 0f; if (this.Placement == Placement.Cross || this.Placement == Placement.Inside) { num = (float)(num + 180.0); } if (this.GetGauge().GetOrientation() == GaugeOrientation.Vertical) { num = (float)(num + 270.0); } if (num > 0.0) { using (Matrix matrix = new Matrix()) { matrix.Rotate(num); markerStyleAttrib.path.Transform(matrix); } } float num2 = this.CalculateMarkerDistance(); ScaleBase scale = this.GetScale(); float positionFromValue = scale.GetPositionFromValue(scale.GetValueLimit(base.Position)); PointF pointOrigin = Point.Empty; pointOrigin = ((this.GetGauge().GetOrientation() != 0) ? g.GetAbsolutePoint(new PointF(num2, positionFromValue)) : g.GetAbsolutePoint(new PointF(positionFromValue, num2))); markerStyleAttrib.brush = g.GetMarkerBrush(markerStyleAttrib.path, this.MarkerStyle, pointOrigin, 0f, this.FillColor, this.FillGradientType, this.FillGradientEndColor, this.FillHatchStyle); using (Matrix matrix2 = new Matrix()) { matrix2.Translate(pointOrigin.X, pointOrigin.Y, MatrixOrder.Append); markerStyleAttrib.path.Transform(matrix2); return(markerStyleAttrib); } }
public override void Render(GaugeGraphics g) { if (this.Common != null && this.Visible && this.GetScale() != null) { this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceStartRendering(this.Name)); g.StartHotRegion(this); if (this.Image != "") { this.DrawImage(g, false); this.SetAllHotRegions(g); g.EndHotRegion(); this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(this.Name)); } else { Pen pen = new Pen(base.BorderColor, (float)base.BorderWidth); pen.DashStyle = g.GetPenStyle(base.BorderStyle); if (pen.DashStyle != 0) { pen.Alignment = PenAlignment.Center; } if (this.Type == LinearPointerType.Bar) { BarStyleAttrib barStyleAttrib = this.GetBarStyleAttrib(g); try { if (barStyleAttrib.primaryPath != null) { g.FillPath(barStyleAttrib.primaryBrush, barStyleAttrib.primaryPath); } if (barStyleAttrib.secondaryPaths != null) { int num = 0; GraphicsPath[] secondaryPaths = barStyleAttrib.secondaryPaths; foreach (GraphicsPath graphicsPath in secondaryPaths) { if (graphicsPath != null && barStyleAttrib.secondaryBrushes[num] != null) { g.FillPath(barStyleAttrib.secondaryBrushes[num], graphicsPath); } num++; } } if (base.BorderWidth > 0 && barStyleAttrib.primaryBrush != null && base.BorderStyle != 0) { g.DrawPath(pen, barStyleAttrib.primaryPath); } } catch (Exception) { barStyleAttrib.Dispose(); } if (barStyleAttrib.primaryPath != null) { this.AddHotRegion(barStyleAttrib.primaryPath, true); } } else if (this.Type == LinearPointerType.Thermometer) { BarStyleAttrib thermometerStyleAttrib = this.GetThermometerStyleAttrib(g); try { if (thermometerStyleAttrib.totalPath != null) { g.FillPath(thermometerStyleAttrib.totalBrush, thermometerStyleAttrib.totalPath); } if (thermometerStyleAttrib.primaryPath != null) { g.FillPath(thermometerStyleAttrib.primaryBrush, thermometerStyleAttrib.primaryPath); } if (thermometerStyleAttrib.secondaryPaths != null) { int num2 = 0; GraphicsPath[] secondaryPaths2 = thermometerStyleAttrib.secondaryPaths; foreach (GraphicsPath graphicsPath2 in secondaryPaths2) { if (graphicsPath2 != null && thermometerStyleAttrib.secondaryBrushes[num2] != null) { g.FillPath(thermometerStyleAttrib.secondaryBrushes[num2], graphicsPath2); } num2++; } } if (base.BorderWidth > 0 && thermometerStyleAttrib.primaryBrush != null && base.BorderStyle != 0) { g.DrawPath(pen, thermometerStyleAttrib.totalPath); } } catch (Exception) { thermometerStyleAttrib.Dispose(); } if (thermometerStyleAttrib.primaryPath != null) { this.AddHotRegion(thermometerStyleAttrib.primaryPath, true); } } else { MarkerStyleAttrib markerStyleAttrib = this.GetMarkerStyleAttrib(g); try { if (markerStyleAttrib.path != null) { bool circularFill = (byte)((this.MarkerStyle == MarkerStyle.Circle) ? 1 : 0) != 0; g.FillPath(markerStyleAttrib.brush, markerStyleAttrib.path, 0f, true, circularFill); } if (base.BorderWidth > 0 && markerStyleAttrib.path != null && base.BorderStyle != 0) { g.DrawPath(pen, markerStyleAttrib.path); } } catch (Exception) { markerStyleAttrib.Dispose(); } if (markerStyleAttrib.path != null) { this.AddHotRegion(markerStyleAttrib.path, true); } } this.SetAllHotRegions(g); g.EndHotRegion(); this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(this.Name)); } } }