Ejemplo n.º 1
0
        internal override void DrawHorz(FRPaintEventArgs e)
        {
            Graphics g   = e.Graphics;
            Pen      pen = e.Cache.GetPen(BorderColor, BorderWidth * e.ScaleX, DashStyle.Solid);

            Left   = (Parent.AbsLeft + Parent.Border.Width / 2 + HorizontalOffset) * e.ScaleX;
            Top    = (Parent.AbsTop + Parent.Border.Width / 2 + (Parent.Height - Parent.Border.Width) / 2 - (Parent.Height - Parent.Border.Width) * PointerRatio / 2) * e.ScaleY;
            Height = ((Parent.Height - Parent.Border.Width) * PointerRatio) * e.ScaleY;
            Width  = (float)((Parent.Width - Parent.Border.Width - HorizontalOffset * 2) * (Parent.Value - Parent.Minimum) / (Parent.Maximum - Parent.Minimum) * e.ScaleX);

            if (type == SimpleProgressPointerType.Small)
            {
                float prntWidth = (Parent.Width - Parent.Border.Width + HorizontalOffset) * e.ScaleX;
                float widthSml  = (Parent.Width - Parent.Border.Width - HorizontalOffset * 2) * smallPointerWidthRatio * e.ScaleX;
                float leftSml   = Left + Width - prntWidth * smallPointerWidthRatio + widthSml / 2;

                if (leftSml >= Left && leftSml + widthSml < Left + prntWidth)
                {
                    Left = leftSml;
                }
                else if (leftSml + widthSml >= Left + prntWidth)
                {
                    Left += prntWidth - widthSml;
                }
                Width = widthSml;
            }
            Brush brush = Fill.CreateBrush(new RectangleF(Left, Top, Width, Height));

            g.FillRectangle(brush, Left, Top, Width, Height);
            g.DrawRectangle(pen, Left, Top, Width, Height);
        }
Ejemplo n.º 2
0
        internal virtual void DrawVert(FRPaintEventArgs e)
        {
            IGraphics g   = e.Graphics;
            Pen       pen = e.Cache.GetPen(BorderColor, BorderWidth * e.ScaleY, DashStyle.Solid);

            width  = ((Parent.Width - Parent.Border.Width) * ptrRatio) * e.ScaleX;
            height = (float)((Parent.Height - Parent.Border.Width - horizontalOffset * 2) * (Parent.Value - Parent.Minimum) / (Parent.Maximum - Parent.Minimum) * e.ScaleY);
            left   = (Parent.AbsLeft + Parent.Border.Width / 2 + (Parent.Width - Parent.Border.Width) / 2 - (Parent.Width - Parent.Border.Width) * ptrRatio / 2) * e.ScaleX;
            top    = (Parent.AbsTop + Parent.Border.Width / 2 + Parent.Height - Parent.Border.Width - horizontalOffset) * e.ScaleY - height;

            Brush brush = Fill.CreateBrush(new RectangleF(left, top, width, height), e.ScaleX, e.ScaleY);

            g.FillRectangle(brush, left, top, width, height);
            g.DrawRectangle(pen, left, top, width, height);
        }
Ejemplo n.º 3
0
        private void DrawBackground(FRPaintEventArgs e, RectangleF rect)
        {
            rect.Width  *= e.ScaleX;
            rect.Height *= e.ScaleY;
            Brush brush = null;

            if (Fill is SolidFill)
            {
                brush = e.Cache.GetBrush((Fill as SolidFill).Color);
            }
            else
            {
                brush = Fill.CreateBrush(rect, e.ScaleX, e.ScaleY);
            }

            e.Graphics.FillRectangle(brush, rect.Left, rect.Top, rect.Width, rect.Height);
            if (!(Fill is SolidFill))
            {
                brush.Dispose();
            }
        }
Ejemplo n.º 4
0
        private void DrawHorz(FRPaintEventArgs e)
        {
            Graphics g   = e.Graphics;
            Pen      pen = e.Cache.GetPen(BorderColor, BorderWidth * e.ScaleX, DashStyle.Solid);

            left   = (float)(Parent.AbsLeft + 0.5f * Units.Centimeters + (Parent.Width - 1.0f * Units.Centimeters) * (Parent.Value - Parent.Minimum) / (Parent.Maximum - Parent.Minimum)) * e.ScaleX;
            top    = (Parent.AbsTop + Parent.Height / 2) * e.ScaleY;
            height = Parent.Height * 0.4f * e.ScaleY;
            width  = Parent.Width * 0.036f * e.ScaleX;

            float dx    = width / 2;
            float dy    = height * 0.3f;
            Brush brush = Fill.CreateBrush(new RectangleF(left - dx, top, width, height));

            PointF[] p = new PointF[]
            {
                new PointF(left, top),
                new PointF(left + dx, top + dy),
                new PointF(left + dx, top + height),
                new PointF(left - dx, top + height),
                new PointF(left - dx, top + dy)
            };

            if ((Parent as LinearGauge).Inverted)
            {
                p[1].Y = top - dy;
                p[2].Y = top - height;
                p[3].Y = top - height;
                p[4].Y = top - dy;
            }

            GraphicsPath path = new GraphicsPath();

            path.AddLines(p);
            path.AddLine(p[4], p[0]);

            g.FillPath(brush, path);
            g.DrawPath(pen, path);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Draw polyline path to graphics
        /// </summary>
        /// <param name="e">Event arguments</param>
        protected override void drawPoly(FRPaintEventArgs e)
        {
            float x  = (AbsLeft + Border.Width / 2) * e.ScaleX;
            float y  = (AbsTop + Border.Width / 2) * e.ScaleY;
            float dx = (Width - Border.Width) * e.ScaleX - 1;
            float dy = (Height - Border.Width) * e.ScaleY - 1;

            Pen pen;

            if (polygonSelectionMode == PolygonSelectionMode.MoveAndScale)
            {
                pen = e.Cache.GetPen(Border.Color, Border.Width * e.ScaleX, Border.DashStyle);
            }
            else
            {
                pen = e.Cache.GetPen(Border.Color, 1, DashStyle.Solid);
            }

            Brush brush = null;

            if (Fill is SolidFill)
            {
                brush = e.Cache.GetBrush((Fill as SolidFill).Color);
            }
            else
            {
                brush = Fill.CreateBrush(new RectangleF(x, y, dx, dy), e.ScaleX, e.ScaleY);
            }

            using (GraphicsPath path = getPolygonPath(pen, e.ScaleX, e.ScaleY))
            {
                if (polygonSelectionMode == PolygonSelectionMode.MoveAndScale)
                {
                    e.Graphics.FillPath(brush, path);
                }
                e.Graphics.DrawPath(pen, path);
            }
        }
Ejemplo n.º 6
0
        internal override void DrawVert(FRPaintEventArgs e)
        {
            Graphics g   = e.Graphics;
            Pen      pen = e.Cache.GetPen(BorderColor, BorderWidth * e.ScaleY, DashStyle.Solid);

            Width  = ((Parent.Width - Parent.Border.Width) * PointerRatio) * e.ScaleX;
            Height = (float)((Parent.Height - Parent.Border.Width - HorizontalOffset * 2) * (Parent.Value - Parent.Minimum) / (Parent.Maximum - Parent.Minimum) * e.ScaleY);
            Left   = (Parent.AbsLeft + Parent.Border.Width / 2 + (Parent.Width - Parent.Border.Width) / 2 - (Parent.Width - Parent.Border.Width) * PointerRatio / 2) * e.ScaleX;
            Top    = (Parent.AbsTop + Parent.Border.Width / 2 + Parent.Height - Parent.Border.Width) * e.ScaleY - Height;

            if (type == SimpleProgressPointerType.Small)
            {
                float prntTop    = (Parent.AbsTop + Parent.Border.Width / 2) * e.ScaleY;
                float prntHeight = (Parent.Height - Parent.Border.Width) * e.ScaleY;
                float heightSml  = (Parent.Height - Parent.Border.Width) * smallPointerWidthRatio * e.ScaleY;
                float topSml     = Top - heightSml / 2;

                if (topSml + heightSml > prntTop + prntHeight)
                {
                    Top = prntTop + prntHeight - heightSml;
                }
                else if (topSml < prntTop)
                {
                    Top = prntTop;
                }
                else
                {
                    Top = topSml;
                }
                Height = heightSml;
            }
            Brush brush = Fill.CreateBrush(new RectangleF(Left, Top, Width, Height));

            g.FillRectangle(brush, Left, Top, Width, Height);
            g.DrawRectangle(pen, Left, Top, Width, Height);
        }
Ejemplo n.º 7
0
        /// <inheritdoc/>
        public override void Draw(FRPaintEventArgs e)
        {
            Graphics g = e.Graphics;

            float x  = (AbsLeft + Border.Width / 2) * e.ScaleX;
            float y  = (AbsTop + Border.Width / 2) * e.ScaleY;
            float dx = (Width - Border.Width) * e.ScaleX - 1;
            float dy = (Height - Border.Width) * e.ScaleY - 1;
            float x1 = x + dx;
            float y1 = y + dy;

            DashStyle[] styles = new DashStyle[] { DashStyle.Solid, DashStyle.Dash, DashStyle.Dot, DashStyle.DashDot, DashStyle.DashDotDot, DashStyle.Solid };
            Pen         pen    = e.Cache.GetPen(Border.Color, Border.Width * e.ScaleX, styles[(int)Border.Style]);
            Brush       brush  = null;

            if (Fill is SolidFill)
            {
                brush = e.Cache.GetBrush((Fill as SolidFill).Color);
            }
            else
            {
                brush = Fill.CreateBrush(new RectangleF(x, y, dx, dy));
            }

            center = new PointF(x + dx / 2, y + dy / 2);

            if (type == RadialGaugeType.Circle)
            {
                g.FillEllipse(brush, x, y, dx, dy);
                g.DrawEllipse(pen, x, y, dx, dy);
            }
            else if (type == RadialGaugeType.Semicircle)
            {
                float semiOffset = (Width / 16f / 2f + 2f) * semicircleOffsetRatio * e.ScaleY;
                if (position == RadialGaugePosition.Top)
                {
                    g.FillPie(brush, x, y, dx, dy, -180, 180);
                    g.DrawArc(pen, x, y, dx, dy, -180, 180);

                    PointF startPoint = RadialUtils.RotateVector(new PointF[] { new PointF(x + dx / 2, y), center }, -90 * RAD, center)[0];

                    PointF[] points = new PointF[4];
                    points[0] = new PointF(startPoint.X, startPoint.Y - 1 * e.ScaleY);
                    points[1] = new PointF(startPoint.X, startPoint.Y + semiOffset);
                    points[2] = new PointF(startPoint.X + dx, startPoint.Y + semiOffset);
                    points[3] = new PointF(startPoint.X + dx, startPoint.Y - 1 * e.ScaleY);
                    GraphicsPath path = new GraphicsPath();
                    path.AddLines(points);
                    g.FillPath(brush, path);
                    g.DrawPath(pen, path);
                }
                else if (position == RadialGaugePosition.Bottom)
                {
                    g.FillPie(brush, x, y, dx, dy, 0, 180);
                    g.DrawArc(pen, x, y, dx, dy, 0, 180);

                    PointF startPoint = RadialUtils.RotateVector(new PointF[] { new PointF(x + dx / 2, y), center }, 90 * RAD, center)[0];

                    PointF[] points = new PointF[4];
                    points[0] = new PointF(startPoint.X, startPoint.Y + 1 * e.ScaleY);
                    points[1] = new PointF(startPoint.X, startPoint.Y - semiOffset);
                    points[2] = new PointF(startPoint.X - dx, startPoint.Y - semiOffset);
                    points[3] = new PointF(startPoint.X - dx, startPoint.Y + 1 * e.ScaleY);
                    GraphicsPath path = new GraphicsPath();
                    path.AddLines(points);
                    g.FillPath(brush, path);
                    g.DrawPath(pen, path);
                }
                else if (position == RadialGaugePosition.Left)
                {
                    g.FillPie(brush, x, y, dx, dy, 90, 180);
                    g.DrawArc(pen, x, y, dx, dy, 90, 180);

                    PointF startPoint = RadialUtils.RotateVector(new PointF[] { new PointF(x + dx / 2, y), center }, 180 * RAD, center)[0];

                    PointF[] points = new PointF[4];
                    points[0] = new PointF(startPoint.X - 1 * e.ScaleX, startPoint.Y);
                    points[1] = new PointF(startPoint.X + semiOffset, startPoint.Y);
                    points[2] = new PointF(startPoint.X + semiOffset, startPoint.Y - dy);
                    points[3] = new PointF(startPoint.X - 1 * e.ScaleX, startPoint.Y - dy);
                    GraphicsPath path = new GraphicsPath();
                    path.AddLines(points);
                    g.FillPath(brush, path);
                    g.DrawPath(pen, path);
                }
                else if (position == RadialGaugePosition.Right)
                {
                    g.FillPie(brush, x, y, dx, dy, -90, 180);
                    g.DrawArc(pen, x, y, dx, dy, -90, 180);

                    PointF startPoint = RadialUtils.RotateVector(new PointF[] { new PointF(x + dx / 2, y), center }, -180 * RAD, center)[0];

                    PointF[] points = new PointF[4];
                    points[0] = new PointF(startPoint.X + 1 * e.ScaleX, startPoint.Y);
                    points[1] = new PointF(startPoint.X - semiOffset, startPoint.Y);
                    points[2] = new PointF(startPoint.X - semiOffset, startPoint.Y - dy);
                    points[3] = new PointF(startPoint.X + 1 * e.ScaleX, startPoint.Y - dy);
                    GraphicsPath path = new GraphicsPath();
                    path.AddLines(points);
                    g.FillPath(brush, path);
                    g.DrawPath(pen, path);
                }
            }
            else if (type == RadialGaugeType.Quadrant)
            {
                float semiOffset = (Width / 16f / 2f + 2f) * semicircleOffsetRatio * e.ScaleY;
                if (RadialUtils.IsTop(this) && RadialUtils.IsLeft(this))
                {
                    g.FillPie(brush, x, y, dx, dy, -180, 90);
                    g.DrawArc(pen, x, y, dx, dy, -180, 90);

                    PointF startPoint = RadialUtils.RotateVector(new PointF[] { new PointF(x + dx / 2, y), center }, -90 * RAD, center)[0];

                    PointF[] points = new PointF[5];
                    points[0] = new PointF(startPoint.X, startPoint.Y - 1 * e.ScaleY);
                    points[1] = new PointF(startPoint.X, startPoint.Y + semiOffset);
                    points[2] = new PointF(startPoint.X + dx / 2 + semiOffset, startPoint.Y + semiOffset);
                    points[3] = new PointF(startPoint.X + dx / 2 + semiOffset, y);
                    points[4] = new PointF(startPoint.X + dx / 2 - 1 * e.ScaleX, y);
                    GraphicsPath path = new GraphicsPath();
                    path.AddLines(points);
                    g.FillPath(brush, path);
                    g.DrawPath(pen, path);
                }
                else if (RadialUtils.IsBottom(this) && RadialUtils.IsLeft(this))
                {
                    g.FillPie(brush, x, y, dx, dy, -270, 90);
                    g.DrawArc(pen, x, y, dx, dy, -270, 90);

                    PointF   startPoint = RadialUtils.RotateVector(new PointF[] { new PointF(x + dx / 2, y), center }, -90 * RAD, center)[0];
                    PointF[] points     = new PointF[5];
                    points[0] = new PointF(startPoint.X, startPoint.Y + 1 * e.ScaleY);
                    points[1] = new PointF(startPoint.X, startPoint.Y - semiOffset);
                    points[2] = new PointF(startPoint.X + dx / 2 + semiOffset, startPoint.Y - semiOffset);
                    points[3] = new PointF(startPoint.X + dx / 2 + semiOffset, y + dy);
                    points[4] = new PointF(x + dx / 2 - 1 * e.ScaleX, y + dy);
                    GraphicsPath path = new GraphicsPath();
                    path.AddLines(points);
                    g.FillPath(brush, path);
                    g.DrawPath(pen, path);
                }
                else if (RadialUtils.IsTop(this) && RadialUtils.IsRight(this))
                {
                    g.FillPie(brush, x, y, dx, dy, -90, 90);
                    g.DrawArc(pen, x, y, dx, dy, -90, 90);

                    PointF startPoint = RadialUtils.RotateVector(new PointF[] { new PointF(x + dx / 2, y), center }, 90 * RAD, center)[0];

                    PointF[] points = new PointF[5];
                    points[0] = new PointF(startPoint.X, startPoint.Y - 1 * e.ScaleY);
                    points[1] = new PointF(startPoint.X, startPoint.Y + semiOffset);
                    points[2] = new PointF(startPoint.X - dx / 2 - semiOffset, startPoint.Y + semiOffset);
                    points[3] = new PointF(x + dx / 2 - semiOffset, y);
                    points[4] = new PointF(x + dx / 2 + 1 * e.ScaleX, y);
                    GraphicsPath path = new GraphicsPath();
                    path.AddLines(points);
                    g.FillPath(brush, path);
                    g.DrawPath(pen, path);
                }
                else if (RadialUtils.IsBottom(this) && RadialUtils.IsRight(this))
                {
                    g.FillPie(brush, x, y, dx, dy, 0, 90);
                    g.DrawArc(pen, x, y, dx, dy, 0, 90);

                    PointF startPoint = RadialUtils.RotateVector(new PointF[] { new PointF(x + dx / 2, y), center }, 90 * RAD, center)[0];

                    PointF[] points = new PointF[5];
                    points[0] = new PointF(startPoint.X, startPoint.Y + 1 * e.ScaleY);
                    points[1] = new PointF(startPoint.X, startPoint.Y - semiOffset);
                    points[2] = new PointF(x + dx / 2 - semiOffset, startPoint.Y - semiOffset);
                    points[3] = new PointF(x + dx / 2 - semiOffset, y + dy);
                    points[4] = new PointF(x + dx / 2 + 1 * e.ScaleX, y + dy);
                    GraphicsPath path = new GraphicsPath();
                    path.AddLines(points);
                    g.FillPath(brush, path);
                    g.DrawPath(pen, path);
                }
            }

            Scale.Draw(e);
            Pointer.Draw(e);
            Label.Draw(e);
            DrawMarkers(e);
            if (!(Fill is SolidFill))
            {
                brush.Dispose();
            }
            if (Report != null && Report.SmoothGraphics)
            {
                g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                g.SmoothingMode     = SmoothingMode.AntiAlias;
            }
        }
Ejemplo n.º 8
0
        /// <inheritdoc/>
        public override void Draw(FRPaintEventArgs e)
        {
            if (Math.Abs(Width) < 1 || Math.Abs(Height) < 1)
            {
                return;
            }

            Graphics g  = e.Graphics;
            float    x  = (AbsLeft + Border.Width / 2) * e.ScaleX;
            float    y  = (AbsTop + Border.Width / 2) * e.ScaleY;
            float    dx = (Width - Border.Width) * e.ScaleX - 1;
            float    dy = (Height - Border.Width) * e.ScaleY - 1;
            float    x1 = x + dx;
            float    y1 = y + dy;

            DashStyle[] styles = new DashStyle[] {
                DashStyle.Solid, DashStyle.Dash, DashStyle.Dot, DashStyle.DashDot, DashStyle.DashDotDot, DashStyle.Solid
            };
            Pen   pen   = e.Cache.GetPen(Border.Color, Border.Width * e.ScaleX, styles[(int)Border.Style]);
            Brush brush = null;

            if (Fill is SolidFill)
            {
                brush = e.Cache.GetBrush((Fill as SolidFill).Color);
            }
            else
            {
                brush = Fill.CreateBrush(new RectangleF(x, y, dx, dy));
            }

            Report report = Report;

            if (report != null && report.SmoothGraphics && Shape != ShapeKind.Rectangle)
            {
                g.InterpolationMode = InterpolationMode.HighQualityBicubic;
                g.SmoothingMode     = SmoothingMode.AntiAlias;
            }

            switch (Shape)
            {
            case ShapeKind.Rectangle:
                g.FillRectangle(brush, x, y, dx, dy);
                g.DrawRectangle(pen, x, y, dx, dy);
                break;

            case ShapeKind.RoundRectangle:
                float min = Math.Min(dx, dy);
                if (curve == 0)
                {
                    min = min / 4;
                }
                else
                {
                    min = Math.Min(min, curve * e.ScaleX * 10);
                }
                GraphicsPath gp = GetRoundRectPath(x, y, x1, y1, min);
                g.FillPath(brush, gp);
                g.DrawPath(pen, gp);
                gp.Dispose();
                break;

            case ShapeKind.Ellipse:
                g.FillEllipse(brush, x, y, dx, dy);
                g.DrawEllipse(pen, x, y, dx, dy);
                break;

            case ShapeKind.Triangle:
                PointF[] triPoints =
                {
                    new PointF(x1, y1), new PointF(x, y1), new PointF(x + dx / 2, y), new PointF(x1, y1)
                };
                g.FillPolygon(brush, triPoints);
                g.DrawPolygon(pen, triPoints);
                break;

            case ShapeKind.Diamond:
                PointF[] diaPoints =
                {
                    new PointF(x + dx / 2, y), new PointF(x1, y + dy / 2), new PointF(x + dx / 2, y1),
                    new PointF(x,          y + dy / 2)
                };
                g.FillPolygon(brush, diaPoints);
                g.DrawPolygon(pen, diaPoints);
                break;
            }

            if (!(Fill is SolidFill))
            {
                brush.Dispose();
            }
            if (report != null && report.SmoothGraphics)
            {
                g.InterpolationMode = InterpolationMode.Default;
                g.SmoothingMode     = SmoothingMode.Default;
            }
        }
Ejemplo n.º 9
0
        private void DrawHorz(FRPaintEventArgs e)
        {
            Graphics g   = e.Graphics;
            Pen      pen = e.Cache.GetPen(BorderColor, BorderWidth * e.ScaleX, DashStyle.Solid);

            PointF     center        = (Parent as RadialGauge).Center;
            float      circleWidth   = Parent.Width / 16f;
            float      circleHeight  = Parent.Height / 16f;
            RectangleF pointerCircle = new RectangleF(center.X - circleWidth / 2 * e.ScaleX, center.Y - circleHeight / 2 * e.ScaleY, circleWidth * e.ScaleX, circleHeight * e.ScaleY);

            //double rotateTo = (scale.AverageValue - Parent.Minimum);
            double startAngle = -135 * RadialGauge.Radians;
            double angle      = (Parent.Value - Parent.Minimum) / scale.StepValue * scale.MajorStep * RadialGauge.Radians;

            if ((Parent as RadialGauge).Type == RadialGaugeType.Semicircle)
            {
                if ((Parent as RadialGauge).Position == RadialGaugePosition.Bottom || (Parent as RadialGauge).Position == RadialGaugePosition.Top)
                {
                    startAngle = -90 * RadialGauge.Radians;
                    if ((Parent as RadialGauge).Position == RadialGaugePosition.Bottom)
                    {
                        angle *= -1;
                    }
                }
                else if ((Parent as RadialGauge).Position == RadialGaugePosition.Left)
                {
                    startAngle = -180 * RadialGauge.Radians;
                }
                else if ((Parent as RadialGauge).Position == RadialGaugePosition.Right)
                {
                    startAngle = -180 * RadialGauge.Radians;
                    angle     *= -1;
                }
            }
            else if (RadialUtils.IsQuadrant(Parent))
            {
                if (RadialUtils.IsLeft(Parent) && RadialUtils.IsTop(Parent))
                {
                    startAngle = -90 * RadialGauge.Radians;
                }
                else if (RadialUtils.IsLeft(Parent) && RadialUtils.IsBottom(Parent))
                {
                    startAngle = -180 * RadialGauge.Radians;
                }
                else if (RadialUtils.IsRight(Parent) && RadialUtils.IsTop(Parent))
                {
                    startAngle = 90 * RadialGauge.Radians;
                }
                else if (RadialUtils.IsRight(Parent) && RadialUtils.IsBottom(Parent))
                {
                    startAngle = 180 * RadialGauge.Radians;
                    angle     *= -1;
                }
            }
            //double startAngle = rotateTo / scale.StepValue * -scale.MajorStep * RadialGauge.Radians;

            float ptrLineY     = center.Y - pointerCircle.Width / 2 - pointerCircle.Width / 5;
            float ptrLineY1    = scale.AvrTick.Y + scale.MinorTicks.Length * 1.7f;
            float ptrLineWidth = circleWidth / 3 * e.ScaleX;

            PointF[] pointerPerpStrt = new PointF[2];
            pointerPerpStrt[0] = new PointF(center.X - ptrLineWidth, ptrLineY);
            pointerPerpStrt[1] = new PointF(center.X + ptrLineWidth, ptrLineY);

            PointF[] pointerPerpEnd = new PointF[2];
            pointerPerpEnd[0] = new PointF(center.X - ptrLineWidth / 3, ptrLineY1);
            pointerPerpEnd[1] = new PointF(center.X + ptrLineWidth / 3, ptrLineY1);


            pointerPerpStrt = RadialUtils.RotateVector(pointerPerpStrt, startAngle, center);
            pointerPerpEnd  = RadialUtils.RotateVector(pointerPerpEnd, startAngle, center);

            PointF[] rotatedPointerPerpStrt = RadialUtils.RotateVector(pointerPerpStrt, angle, center);
            PointF[] rotatedPointerPerpEnd  = RadialUtils.RotateVector(pointerPerpEnd, angle, center);

            //calc brush rect
            float x = 0, y = 0, dx = 0, dy = 0;

            if (angle / RadialGauge.Radians >= 0 && angle / RadialGauge.Radians < 45)
            {
                x  = rotatedPointerPerpEnd[1].X;
                y  = rotatedPointerPerpEnd[0].Y - (rotatedPointerPerpEnd[0].Y - pointerCircle.Y);
                dx = pointerCircle.X + pointerCircle.Width - rotatedPointerPerpEnd[0].X;
                dy = rotatedPointerPerpEnd[0].Y - pointerCircle.Y;
            }
            else if (angle / RadialGauge.Radians >= 45 && angle / RadialGauge.Radians < 90)
            {
                x  = rotatedPointerPerpEnd[0].X;
                y  = rotatedPointerPerpEnd[1].Y;
                dx = pointerCircle.X + pointerCircle.Width - rotatedPointerPerpEnd[0].X;
                dy = pointerCircle.Y + pointerCircle.Height - rotatedPointerPerpEnd[0].Y;
            }
            else if (angle / RadialGauge.Radians >= 90 && angle / RadialGauge.Radians < 135)
            {
                x  = rotatedPointerPerpEnd[0].X;
                y  = rotatedPointerPerpEnd[1].Y;
                dx = pointerCircle.X + pointerCircle.Width - rotatedPointerPerpEnd[0].X;
                dy = pointerCircle.Y + pointerCircle.Height - rotatedPointerPerpEnd[1].Y;
            }
            else if (angle / RadialGauge.Radians >= 135 && angle / RadialGauge.Radians < 225)
            {
                x  = pointerCircle.X;
                y  = rotatedPointerPerpEnd[0].Y;
                dx = rotatedPointerPerpEnd[1].X - pointerCircle.X;
                dy = pointerCircle.Y + pointerCircle.Height - rotatedPointerPerpEnd[0].Y;
            }
            else if (angle / RadialGauge.Radians >= 225)
            {
                x  = pointerCircle.X;
                y  = pointerCircle.Y;
                dx = rotatedPointerPerpEnd[0].X - pointerCircle.X;
                dy = rotatedPointerPerpEnd[1].Y - pointerCircle.Y;
            }
            RectangleF brushRect = new RectangleF(x, y, dx, dy);

            if (gradAutoRotate && Fill is LinearGradientFill)
            {
                (Fill as LinearGradientFill).Angle = (int)(startAngle / RadialGauge.Radians + angle / RadialGauge.Radians) + 90;
            }
            Brush brush          = Fill.CreateBrush(brushRect, e.ScaleX, e.ScaleY);

            PointF[] p = new PointF[]
            {
                rotatedPointerPerpStrt[0],
                rotatedPointerPerpStrt[1],
                rotatedPointerPerpEnd[1],
                rotatedPointerPerpEnd[0],
            };
            GraphicsPath path = new GraphicsPath();

            path.AddLines(p);
            path.AddLine(p[3], p[0]);

            g.FillEllipse(brush, pointerCircle);
            g.DrawEllipse(pen, pointerCircle);

            g.FillPath(brush, path);
            g.DrawPath(pen, path);
        }