Пример #1
0
        public override void Render(GaugeGraphics g)
        {
            if (this.Common != null && base.Visible && this.GetScale() != null && !double.IsNaN(this.StartValue) && !double.IsNaN(this.EndValue))
            {
                this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceStartRendering(this.Name));
                g.StartHotRegion(this);
                LinearScale  scale        = this.GetScale();
                Pen          pen          = null;
                Brush        brush        = null;
                GraphicsPath graphicsPath = null;
                try
                {
                    graphicsPath = g.GetLinearRangePath(scale.GetPositionFromValue(this.StartValue), scale.GetPositionFromValue(this.EndValue), this.StartWidth, this.EndWidth, scale.Position, this.GetGauge().GetOrientation(), this.DistanceFromScale, this.Placement, scale.Width);
                    if (graphicsPath != null && g.Graphics.VisibleClipBounds.IntersectsWith(graphicsPath.GetBounds()))
                    {
                        brush         = g.GetLinearRangeBrush(graphicsPath.GetBounds(), base.FillColor, base.FillHatchStyle, base.FillGradientType, base.FillGradientEndColor, this.GetGauge().GetOrientation(), this.GetScale().GetReversed(), this.StartValue, this.EndValue);
                        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);
                        }
                        goto end_IL_0069;
                    }
                    g.EndHotRegion();
                    this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(this.Name));
                    return;

                    end_IL_0069 :;
                }
                catch (Exception)
                {
                    if (graphicsPath != null)
                    {
                        graphicsPath.Dispose();
                    }
                    if (pen != null)
                    {
                        pen.Dispose();
                    }
                    if (brush != null)
                    {
                        brush.Dispose();
                    }
                    throw;
                }
                this.Common.GaugeCore.HotRegionList.SetHotRegion(this, PointF.Empty, graphicsPath);
                g.EndHotRegion();
                this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(this.Name));
            }
        }
Пример #2
0
 void IRenderable.RenderStaticElements(GaugeGraphics g)
 {
     if (this.Visible)
     {
         g.StartHotRegion(this);
         if (this.Image.Length != 0)
         {
             this.DrawImage(g, this.image, true);
             this.DrawImage(g, this.image, false);
             g.EndHotRegion();
         }
         else
         {
             GraphicsPath graphicsPath  = null;
             GraphicsPath graphicsPath2 = null;
             try
             {
                 graphicsPath  = this.GetTextPath(g);
                 graphicsPath2 = this.GetBackPath(g);
                 g.FillPath(Brushes.White, graphicsPath2);
                 AntiAliasing antiAliasing  = this.Common.GaugeContainer.AntiAliasing;
                 AntiAliasing antiAliasing2 = g.AntiAliasing;
                 if (this.Common.GaugeContainer.AntiAliasing == AntiAliasing.Text)
                 {
                     antiAliasing = AntiAliasing.Graphics;
                 }
                 else if (this.Common.GaugeContainer.AntiAliasing == AntiAliasing.Graphics)
                 {
                     antiAliasing = AntiAliasing.None;
                 }
                 g.AntiAliasing = antiAliasing;
                 g.FillPath(Brushes.Black, graphicsPath);
                 g.AntiAliasing = antiAliasing2;
                 g.DrawPath(Pens.Black, graphicsPath2);
                 this.Common.GaugeCore.HotRegionList.SetHotRegion(this, Point.Empty, (GraphicsPath)graphicsPath2.Clone());
             }
             finally
             {
                 if (graphicsPath != null)
                 {
                     graphicsPath.Dispose();
                 }
                 if (graphicsPath2 != null)
                 {
                     graphicsPath2.Dispose();
                 }
                 g.EndHotRegion();
             }
         }
     }
 }
Пример #3
0
        void IRenderable.RenderStaticElements(GaugeGraphics g)
        {
            if (!Visible)
            {
                return;
            }
            g.StartHotRegion(this);
            if (Image.Length != 0)
            {
                DrawImage(g, image, drawShadow: true);
                DrawImage(g, image, drawShadow: false);
                g.EndHotRegion();
                return;
            }
            GraphicsPath graphicsPath  = null;
            GraphicsPath graphicsPath2 = null;

            try
            {
                graphicsPath  = GetTextPath(g);
                graphicsPath2 = GetBackPath(g);
                g.FillPath(Brushes.White, graphicsPath2);
                AntiAliasing antiAliasing  = Common.GaugeContainer.AntiAliasing;
                AntiAliasing antiAliasing2 = g.AntiAliasing;
                if (Common.GaugeContainer.AntiAliasing == AntiAliasing.Text)
                {
                    antiAliasing = AntiAliasing.Graphics;
                }
                else if (Common.GaugeContainer.AntiAliasing == AntiAliasing.Graphics)
                {
                    antiAliasing = AntiAliasing.None;
                }
                g.AntiAliasing = antiAliasing;
                g.FillPath(Brushes.Black, graphicsPath);
                g.AntiAliasing = antiAliasing2;
                g.DrawPath(Pens.Black, graphicsPath2);
                Common.GaugeCore.HotRegionList.SetHotRegion(this, Point.Empty, (GraphicsPath)graphicsPath2.Clone());
            }
            finally
            {
                graphicsPath?.Dispose();
                graphicsPath2?.Dispose();
                g.EndHotRegion();
            }
        }
Пример #4
0
        internal override void Render(GaugeGraphics g)
        {
            if (Common == null || !base.Visible || GetScale() == null || double.IsNaN(StartValue) || double.IsNaN(EndValue))
            {
                return;
            }
            Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceStartRendering(Name));
            g.StartHotRegion(this);
            LinearScale  scale        = GetScale();
            Pen          pen          = null;
            Brush        brush        = null;
            GraphicsPath graphicsPath = null;

            try
            {
                graphicsPath = g.GetLinearRangePath(scale.GetPositionFromValue(StartValue), scale.GetPositionFromValue(EndValue), StartWidth, EndWidth, scale.Position, GetGauge().GetOrientation(), DistanceFromScale, Placement, scale.Width);
                if (graphicsPath == null || !g.Graphics.VisibleClipBounds.IntersectsWith(graphicsPath.GetBounds()))
                {
                    g.EndHotRegion();
                    Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(Name));
                    return;
                }
                brush         = g.GetLinearRangeBrush(graphicsPath.GetBounds(), base.FillColor, base.FillHatchStyle, base.FillGradientType, base.FillGradientEndColor, GetGauge().GetOrientation(), GetScale().GetReversed(), StartValue, EndValue);
                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();
                throw;
            }
            Common.GaugeCore.HotRegionList.SetHotRegion(this, PointF.Empty, graphicsPath);
            g.EndHotRegion();
            Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(Name));
        }
Пример #5
0
 public override void RenderStaticElements(GaugeGraphics g)
 {
     if (base.Visible)
     {
         g.StartHotRegion(this);
         base.BackFrame.RenderFrame(g);
         GraphicsState gstate = g.Save();
         if (base.ClipContent && base.BackFrame.FrameStyle != 0 && base.BackFrame.Image == string.Empty)
         {
             GraphicsPath graphicsPath = null;
             try
             {
                 graphicsPath = base.BackFrame.GetBackPath(g);
                 g.SetClip(graphicsPath, CombineMode.Intersect);
             }
             finally
             {
                 if (graphicsPath != null)
                 {
                     graphicsPath.Dispose();
                 }
             }
         }
         this.Common.GaugeCore.HotRegionList.SetHotRegion(this, g.GetAbsolutePoint(this.PivotPoint.ToPoint()), base.BackFrame.GetFramePath(g, 0f));
         g.EndHotRegion();
         g.GetAbsoluteRectangle(new RectangleF(0f, 0f, 100f, 100f));
         this.RenderStaticShadows(g);
         foreach (CircularRange range in this.Ranges)
         {
             range.Render(g);
         }
         foreach (CircularScale scale in this.Scales)
         {
             scale.RenderStaticElements(g);
         }
         foreach (CircularPointer pointer in this.Pointers)
         {
             pointer.ResetCachedXamlRenderer();
         }
         if (base.ClipContent && base.BackFrame.FrameStyle != 0 && base.BackFrame.Image == string.Empty)
         {
             g.Restore(gstate);
         }
     }
 }
Пример #6
0
        internal void RenderStaticElements(GaugeGraphics g)
        {
            if (!base.Visible)
            {
                return;
            }
            Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceStartRendering(Name));
            g.StartHotRegion(this);
            GraphicsState gstate = g.Save();

            SetDrawRegion(g);
            try
            {
                staticRendering = true;
                if (!base.TickMarksOnTop)
                {
                    markers.Clear();
                }
                labels.Clear();
                RenderBar(g);
                RenderCustomLabels(g);
                if (!base.TickMarksOnTop)
                {
                    RenderGrid(g);
                }
                RenderLabels(g);
                RenderPins(g);
                SetScaleHitTestPath(g);
                if (!base.TickMarksOnTop)
                {
                    markers.Sort();
                }
            }
            finally
            {
                g.RestoreDrawRegion();
                g.Restore(gstate);
                g.EndHotRegion();
            }
            Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(Name));
        }
Пример #7
0
 public override void RenderStaticElements(GaugeGraphics g)
 {
     if (base.Visible)
     {
         this.AbsoluteSize = g.GetAbsoluteSize(base.Size);
         g.StartHotRegion(this);
         base.BackFrame.RenderFrame(g);
         GraphicsState gstate = g.Save();
         if (base.ClipContent && base.BackFrame.FrameStyle != 0 && base.BackFrame.Image == string.Empty)
         {
             GraphicsPath graphicsPath = null;
             try
             {
                 graphicsPath = ((base.BackFrame.FrameStyle != 0) ? base.BackFrame.GetBackPath(g) : base.BackFrame.GetFramePath(g, 0f));
                 g.SetClip(graphicsPath, CombineMode.Intersect);
             }
             finally
             {
                 if (graphicsPath != null)
                 {
                     graphicsPath.Dispose();
                 }
             }
         }
         this.Common.GaugeCore.HotRegionList.SetHotRegion(this, PointF.Empty, base.BackFrame.GetFramePath(g, 0f));
         g.EndHotRegion();
         this.RenderStaticShadows(g);
         foreach (LinearRange range in this.Ranges)
         {
             range.Render(g);
         }
         foreach (LinearScale scale in this.Scales)
         {
             scale.RenderStaticElements(g);
         }
         if (base.ClipContent && base.BackFrame.FrameStyle != 0 && base.BackFrame.Image == string.Empty)
         {
             g.Restore(gstate);
         }
     }
 }
Пример #8
0
 public void RenderStaticElements(GaugeGraphics g)
 {
     if (base.Visible)
     {
         this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceStartRendering(this.Name));
         g.StartHotRegion(this);
         GraphicsState gstate = g.Save();
         try
         {
             base.staticRendering = true;
             if (!base.TickMarksOnTop)
             {
                 base.markers.Clear();
             }
             base.labels.Clear();
             this.RenderBar(g);
             base.RenderCustomLabels(g);
             if (!base.TickMarksOnTop)
             {
                 base.RenderGrid(g);
             }
             this.RenderLabels(g);
             base.RenderPins(g);
             this.SetScaleHitTestPath(g);
             if (!base.TickMarksOnTop)
             {
                 base.markers.Sort();
             }
         }
         finally
         {
             g.Restore(gstate);
             g.EndHotRegion();
         }
         this.Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(this.Name));
     }
 }
Пример #9
0
        internal override void Render(GaugeGraphics g)
        {
            if (Common == null || !Visible || GetScale() == null)
            {
                return;
            }
            Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceStartRendering(Name));
            g.StartHotRegion(this);
            if (Image != "")
            {
                DrawImage(g, drawShadow: false);
                SetAllHotRegions(g);
                g.EndHotRegion();
                Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(Name));
                return;
            }
            Pen pen = new Pen(base.BorderColor, base.BorderWidth);

            pen.DashStyle = g.GetPenStyle(base.BorderStyle);
            if (pen.DashStyle != 0)
            {
                pen.Alignment = PenAlignment.Center;
            }
            if (Type == LinearPointerType.Bar)
            {
                BarStyleAttrib barStyleAttrib = 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)
                {
                    AddHotRegion(barStyleAttrib.primaryPath, primary: true);
                }
            }
            else if (Type == LinearPointerType.Thermometer)
            {
                BarStyleAttrib thermometerStyleAttrib = 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[] secondaryPaths = thermometerStyleAttrib.secondaryPaths;
                        foreach (GraphicsPath graphicsPath2 in secondaryPaths)
                        {
                            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)
                {
                    AddHotRegion(thermometerStyleAttrib.primaryPath, primary: true);
                }
            }
            else
            {
                MarkerStyleAttrib markerStyleAttrib = GetMarkerStyleAttrib(g);
                try
                {
                    if (markerStyleAttrib.path != null)
                    {
                        bool circularFill = (MarkerStyle == MarkerStyle.Circle) ? true : false;
                        g.FillPath(markerStyleAttrib.brush, markerStyleAttrib.path, 0f, useBrushOffset: 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)
                {
                    AddHotRegion(markerStyleAttrib.path, primary: true);
                }
            }
            SetAllHotRegions(g);
            g.EndHotRegion();
            Common.GaugeCore.TraceWrite("GaugePaint", SR.TraceRenderingComplete(Name));
        }
Пример #10
0
 void IRenderable.RenderDynamicElements(GaugeGraphics g)
 {
     if (this.Visible)
     {
         g.StartHotRegion(this);
         GraphicsPath graphicsPath  = null;
         GraphicsPath graphicsPath2 = null;
         Brush        brush         = null;
         Brush        brush2        = null;
         Brush        brush3        = null;
         Pen          pen           = null;
         try
         {
             graphicsPath  = this.GetBackPath(g);
             graphicsPath2 = this.GetTextPath(g);
             if (graphicsPath != null)
             {
                 if (this.BackShadowOffset != 0)
                 {
                     using (Matrix matrix = new Matrix())
                     {
                         brush3 = g.GetShadowBrush();
                         matrix.Translate((float)this.BackShadowOffset, (float)this.BackShadowOffset, MatrixOrder.Append);
                         graphicsPath.Transform(matrix);
                         g.FillPath(brush3, graphicsPath);
                         matrix.Reset();
                         matrix.Translate((float)(-this.BackShadowOffset), (float)(-this.BackShadowOffset), MatrixOrder.Append);
                         graphicsPath.Transform(matrix);
                     }
                 }
                 brush2 = this.GetBackBrush(g);
                 g.FillPath(brush2, graphicsPath);
                 pen = this.GetPen(g);
                 if (pen != null)
                 {
                     g.DrawPath(pen, graphicsPath);
                 }
                 this.Common.GaugeCore.HotRegionList.SetHotRegion(this, Point.Empty, (GraphicsPath)graphicsPath.Clone());
             }
             if (graphicsPath2 != null)
             {
                 if (this.TextShadowOffset != 0)
                 {
                     using (Matrix matrix2 = new Matrix())
                     {
                         brush3 = g.GetShadowBrush();
                         matrix2.Translate((float)this.TextShadowOffset, (float)this.TextShadowOffset, MatrixOrder.Append);
                         graphicsPath2.Transform(matrix2);
                         g.FillPath(brush3, graphicsPath2);
                         matrix2.Reset();
                         matrix2.Translate((float)(-this.TextShadowOffset), (float)(-this.TextShadowOffset), MatrixOrder.Append);
                         graphicsPath2.Transform(matrix2);
                     }
                 }
                 brush = new SolidBrush(this.TextColor);
                 AntiAliasing antiAliasing  = this.Common.GaugeContainer.AntiAliasing;
                 AntiAliasing antiAliasing2 = g.AntiAliasing;
                 if (this.Common.GaugeContainer.AntiAliasing == AntiAliasing.Text)
                 {
                     antiAliasing = AntiAliasing.Graphics;
                 }
                 else if (this.Common.GaugeContainer.AntiAliasing == AntiAliasing.Graphics)
                 {
                     antiAliasing = AntiAliasing.None;
                 }
                 g.AntiAliasing = antiAliasing;
                 g.FillPath(brush, graphicsPath2);
                 g.AntiAliasing = antiAliasing2;
             }
         }
         finally
         {
             if (graphicsPath != null)
             {
                 graphicsPath.Dispose();
             }
             if (graphicsPath2 != null)
             {
                 graphicsPath2.Dispose();
             }
             if (brush3 != null)
             {
                 brush3.Dispose();
             }
             if (brush2 != null)
             {
                 brush2.Dispose();
             }
             if (brush != null)
             {
                 brush.Dispose();
             }
             if (pen != null)
             {
                 pen.Dispose();
             }
             g.EndHotRegion();
         }
     }
 }
 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));
         }
     }
 }
 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));
         }
     }
 }
Пример #13
0
 public override void Render(GaugeGraphics g)
 {
     if (this.Common != null && this.Visible && this.GetScale() != null)
     {
         g.StartHotRegion(this);
         this.GetScale().SetDrawRegion(g);
         if (this.Image != "" && this.CapImage != "")
         {
             this.DrawImage(g, true, false);
             this.DrawImage(g, false, false);
             this.SetAllHotRegions(g);
             g.RestoreDrawRegion();
             g.EndHotRegion();
         }
         else
         {
             if (this.Image != "")
             {
                 this.DrawImage(g, true, false);
             }
             float  positionFromValue = this.GetScale().GetPositionFromValue(base.Position);
             PointF absolutePoint     = g.GetAbsolutePoint(this.GetScale().GetPivotPoint());
             Pen    pen = new Pen(base.BorderColor, (float)base.BorderWidth);
             pen.DashStyle = g.GetPenStyle(base.BorderStyle);
             if (pen.DashStyle != 0)
             {
                 pen.Alignment = PenAlignment.Center;
             }
             KnobStyleAttrib knobStyleAttrib = this.GetKnobStyleAttrib(g, absolutePoint, positionFromValue);
             try
             {
                 if (knobStyleAttrib.paths != null)
                 {
                     for (int i = 0; i < knobStyleAttrib.paths.Length; i++)
                     {
                         if (knobStyleAttrib.brushes[i] != null && knobStyleAttrib.paths[i] != null)
                         {
                             g.FillPath(knobStyleAttrib.brushes[i], knobStyleAttrib.paths[i]);
                         }
                     }
                     if (base.BorderWidth > 0 && knobStyleAttrib.paths[0] != null)
                     {
                         g.DrawPath(pen, knobStyleAttrib.paths[0]);
                     }
                     if (knobStyleAttrib.paths[0] != null)
                     {
                         this.AddHotRegion((GraphicsPath)knobStyleAttrib.paths[0].Clone(), true);
                     }
                 }
             }
             finally
             {
                 knobStyleAttrib.Dispose();
             }
             if (this.CapImage != "")
             {
                 this.DrawImage(g, false, false);
             }
             this.SetAllHotRegions(g);
             g.RestoreDrawRegion();
             g.EndHotRegion();
         }
     }
 }
Пример #14
0
        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));
        }
Пример #15
0
        internal override void Render(GaugeGraphics g)
        {
            if (Common == null || !Visible || GetScale() == null)
            {
                return;
            }
            g.StartHotRegion(this);
            GetScale().SetDrawRegion(g);
            if (Image != "" && CapImage != "")
            {
                DrawImage(g, primary: true, drawShadow: false);
                DrawImage(g, primary: false, drawShadow: false);
                SetAllHotRegions(g);
                g.RestoreDrawRegion();
                g.EndHotRegion();
                return;
            }
            if (Image != "")
            {
                DrawImage(g, primary: true, drawShadow: false);
            }
            float  positionFromValue = GetScale().GetPositionFromValue(base.Position);
            PointF absolutePoint     = g.GetAbsolutePoint(GetScale().GetPivotPoint());
            Pen    pen = new Pen(base.BorderColor, base.BorderWidth);

            pen.DashStyle = g.GetPenStyle(base.BorderStyle);
            if (pen.DashStyle != 0)
            {
                pen.Alignment = PenAlignment.Center;
            }
            KnobStyleAttrib knobStyleAttrib = GetKnobStyleAttrib(g, absolutePoint, positionFromValue);

            try
            {
                if (knobStyleAttrib.paths != null)
                {
                    for (int i = 0; i < knobStyleAttrib.paths.Length; i++)
                    {
                        if (knobStyleAttrib.brushes[i] != null && knobStyleAttrib.paths[i] != null)
                        {
                            g.FillPath(knobStyleAttrib.brushes[i], knobStyleAttrib.paths[i]);
                        }
                    }
                    if (base.BorderWidth > 0 && knobStyleAttrib.paths[0] != null)
                    {
                        g.DrawPath(pen, knobStyleAttrib.paths[0]);
                    }
                    if (knobStyleAttrib.paths[0] != null)
                    {
                        AddHotRegion((GraphicsPath)knobStyleAttrib.paths[0].Clone(), primary: true);
                    }
                }
            }
            finally
            {
                knobStyleAttrib.Dispose();
            }
            if (CapImage != "")
            {
                DrawImage(g, primary: false, drawShadow: false);
            }
            SetAllHotRegions(g);
            g.RestoreDrawRegion();
            g.EndHotRegion();
        }