Esempio n. 1
0
 protected override void OnRender(IDrawingContext dc, RectFloat clipRect)
 {
     dc.Clear(new ColorRgba128Float?(this.BackColor));
     using (dc.UseTranslateTransform(0.5f, 0.5f, MatrixMultiplyOrder.Append))
     {
         RectDouble    num       = RectDouble.Inflate(base.ClientRectangle.ToRectInt32(), -1.0, -1.0);
         double        num3      = Math.Min(num.Width, num.Height) / 2.0;
         PointDouble   center    = new PointDouble(num.X + num3, num.Y + num3);
         double        d         = MathUtil.DegreesToRadians(this.value);
         EllipseDouble ellipse   = new EllipseDouble(center, num3 - 0.5, num3 - 0.5);
         double        thickness = this.hover ? 2.0 : 1.0;
         double        num8      = this.maxValue - this.minValue;
         if (num8 >= 360.0)
         {
             dc.FillEllipse(ellipse, validAnglesFillBrush);
             dc.DrawEllipse(ellipse, outlineBrush, thickness);
         }
         else
         {
             dc.FillEllipse(ellipse, invalidAnglesFillBrush);
             double      width = num3;
             PointDouble num14 = new PointDouble(center.X + (width * Math.Cos(MathUtil.DegreesToRadians(this.minValue))), center.Y - (width * Math.Sin(MathUtil.DegreesToRadians(this.minValue))));
             PointDouble num15 = new PointDouble(center.X + (width * Math.Cos(MathUtil.DegreesToRadians(this.maxValue))), center.Y - (width * Math.Sin(MathUtil.DegreesToRadians(this.maxValue))));
             SizeDouble  num16 = new SizeDouble(width, width);
             if (this.validRangeGeometry == null)
             {
                 this.validRangeGeometry        = new PathGeometry();
                 this.validRangeFigure          = new PathFigure();
                 this.validRangeFigure.IsFilled = true;
                 this.validRangeFigure.IsClosed = true;
                 this.validRangeGeometry.Figures.Add(this.validRangeFigure);
                 this.validRangeLineSegment1 = new LineSegment();
                 this.validRangeFigure.Segments.Add(this.validRangeLineSegment1);
                 this.validRangeArcSegment = new ArcSegment();
                 this.validRangeArcSegment.SweepDirection = SweepDirection.Counterclockwise;
                 this.validRangeFigure.Segments.Add(this.validRangeArcSegment);
                 this.validRangeLineSegment2 = new LineSegment();
                 this.validRangeFigure.Segments.Add(this.validRangeLineSegment2);
             }
             this.validRangeFigure.StartPoint     = center;
             this.validRangeLineSegment1.Point    = num14;
             this.validRangeArcSegment.Point      = num15;
             this.validRangeArcSegment.IsLargeArc = num8 >= 180.0;
             this.validRangeArcSegment.Size       = num16;
             this.validRangeLineSegment2.Point    = num15;
             dc.FillGeometry(this.validRangeGeometry, validAnglesFillBrush, null);
             dc.DrawEllipse(ellipse, outlineBrush, thickness);
             dc.DrawLine(center, num14, outlineBrush, 0.5);
             dc.DrawLine(center, num15, outlineBrush, 0.5);
         }
         double        num9   = num3 - 2.0;
         PointDouble   num10  = new PointDouble(center.X + (num9 * Math.Cos(d)), center.Y - (num9 * Math.Sin(d)));
         double        radius = 2.5;
         EllipseDouble num12  = new EllipseDouble(center, radius);
         dc.FillEllipse(num12, gripFillBrush);
         dc.DrawLine(center, num10, gripBrush, this.hover ? 2.0 : 1.5);
     }
     base.OnRender(dc, clipRect);
 }