示例#1
0
        private void DrawText(FRPaintEventArgs e, string text, Brush brush, float x, float y, HorAlign hAlign, VertAlign vAlign)
        {
            Graphics g       = e.Graphics;
            Font     font    = RadialUtils.GetFont(e, Parent, Font);
            SizeF    strSize = RadialUtils.GetStringSize(e, Parent, Font, text);
            float    dx      = 0;
            float    dy      = 0;

            if (hAlign == HorAlign.Middle)
            {
                dx = -strSize.Width / 2;
            }
            else if (hAlign == HorAlign.Left)
            {
                dx = 0;
            }
            else if (hAlign == HorAlign.Right)
            {
                dx = -strSize.Width;
            }

            if (vAlign == VertAlign.Bottom)
            {
                dy = -strSize.Height;
            }
            else if (vAlign == VertAlign.Middle)
            {
                dy = -strSize.Height / 2;
            }
            else if (vAlign == VertAlign.Top)
            {
                dy = 0;
            }
            g.DrawString(text, font, brush, x + dx, y + dy);
        }
示例#2
0
        public override void Draw(FRPaintEventArgs e)
        {
            if ((Parent as RadialGauge).Type == RadialGaugeType.Circle)
            {
                base.Draw(e);
                float x  = (Parent.AbsLeft + Parent.Border.Width / 2) * e.ScaleX;
                float y  = (Parent.AbsTop + Parent.Border.Width / 2) * e.ScaleY;
                float dx = (Parent.Width - Parent.Border.Width) * e.ScaleX - 1;
                float dy = (Parent.Height - Parent.Border.Width) * e.ScaleY - 1;

                PointF lblPt   = new PointF(x + dx / 2, y + dy - ((Parent.Scale as RadialScale).AvrTick.Y - y));
                SizeF  txtSize = RadialUtils.GetStringSize(e, Parent, Font, Text);
                Font   font    = RadialUtils.GetFont(e, Parent, Font);
                Brush  brush   = e.Cache.GetBrush(Color);
                e.Graphics.DrawString(Text, font, brush, lblPt.X - txtSize.Width / 2, lblPt.Y - txtSize.Height / 2);
            }
        }
示例#3
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;
            }
        }
示例#4
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);
        }
示例#5
0
 private bool isNegative(int i, bool isRightPart)
 {
     if (RadialUtils.IsSemicircle(Parent) || RadialUtils.IsQuadrant(Parent))
     {
         if (i <= sideTicksCount / 2)
         {
             if (isRightPart)
             {
                 if (RadialUtils.IsBottom(Parent) && RadialUtils.IsLeft(Parent))
                 {
                     return(false);
                 }
                 else if (RadialUtils.IsBottom(Parent))
                 {
                     return(false);
                 }
                 else if (RadialUtils.IsLeft(Parent))
                 {
                     return(true);
                 }
                 else if (RadialUtils.IsRight(Parent))
                 {
                     return(true); //!!!!!!!!!!!!!!!!!!
                 }
                 else
                 {
                     return(true); //Check!!!!
                 }
             }
             else
             {
                 if (RadialUtils.IsTop(Parent) && RadialUtils.IsLeft(Parent))
                 {
                     return(true);
                 }
                 else if (RadialUtils.IsBottom(Parent))
                 {
                     return(false);
                 }
                 else if (RadialUtils.IsLeft(Parent))
                 {
                     return(false);
                 }
                 else if (RadialUtils.IsRight(Parent))
                 {
                     return(false); //!!!!!!!!!!!!!!!!!!
                 }
                 else
                 {
                     return(true); //Check!!!!
                 }
             }
         }
         return(false); //shouldn't be reached
     }
     else if (i > sideTicksCount / 2)
     {
         return(false);
     }
     else
     {
         return(true);
     }
 }
示例#6
0
        private void DrawMinorTicks(FRPaintEventArgs e)
        {
            Graphics g   = e.Graphics;
            Pen      pen = e.Cache.GetPen(MinorTicks.Color, MinorTicks.Width * e.ScaleX, DashStyle.Solid);

            MinorTicks.Length = width / 24;
            minorTicksOffset  = majorTicksOffset + MajorTicks.Length / 2 - MinorTicks.Length / 2;
            PointF center = new PointF(left + width / 2, top + height / 2);

            PointF[] tick0 = new PointF[2];
            //first tick
            tick0[0] = new PointF(left + width / 2, top + minorTicksOffset);
            tick0[1] = new PointF(tick0[0].X, tick0[0].Y + MinorTicks.Length);

            double angle = 0;

            if (RadialUtils.IsSemicircle(Parent) || RadialUtils.IsQuadrant(Parent))
            {
                if (RadialUtils.IsBottom(Parent) && RadialUtils.IsLeft(Parent))
                {
                    angle = -180 * RadialGauge.Radians;
                }
                else if (RadialUtils.IsTop(Parent) && RadialUtils.IsLeft(Parent))
                {
                    angle = 0;
                }
                else if (RadialUtils.IsTop(Parent) && RadialUtils.IsRight(Parent))
                {
                    angle = 0;
                }
                else if (RadialUtils.IsBottom(Parent))
                {
                    angle      = 180 * RadialGauge.Radians;
                    majorStep *= -1;
                }
                else if (RadialUtils.IsLeft(Parent))
                {
                    angle = -90 * RadialGauge.Radians;
                }
                else if (RadialUtils.IsRight(Parent))
                {
                    angle      = 90 * RadialGauge.Radians;
                    majorStep *= -1;
                }
            }
            tick0 = RadialUtils.RotateVector(tick0, angle, center);

            //rest of ticks
            PointF[] tick = new PointF[2];
            angle = minorStep * RadialGauge.Radians;
            for (int i = 0; i < MajorTicks.Count / 2 * (MinorTicks.Count + 1); i++)
            {
                if ((i + 1) % (MinorTicks.Count + 1) != 0)
                {
                    if (drawRight)
                    {
                        tick = RadialUtils.RotateVector(tick0, angle, center);
                        g.DrawLine(pen, tick[0].X, tick[0].Y, tick[1].X, tick[1].Y);
                    }
                    if (drawLeft)
                    {
                        angle *= -1;
                        tick   = RadialUtils.RotateVector(tick0, angle, center);
                        g.DrawLine(pen, tick[0].X, tick[0].Y, tick[1].X, tick[1].Y);
                        angle *= -1;
                    }
                }
                angle += minorStep * RadialGauge.Radians;
            }
        }
示例#7
0
        private void DrawMajorTicks(FRPaintEventArgs e)
        {
            center    = (Parent as RadialGauge).Center;
            stepValue = (Parent.Maximum - Parent.Minimum) / (MajorTicks.Count - 1);
            if (RadialUtils.IsQuadrant(Parent))
            {
                stepValue *= 2;
            }

            avrValue = Parent.Minimum + (Parent.Maximum - Parent.Minimum) / 2;

            bool   isRightPart = true;
            bool   isLeftPart  = false;
            PointF txtPoint;

            Graphics g     = e.Graphics;
            Pen      pen   = e.Cache.GetPen(MajorTicks.Color, MajorTicks.Width * e.ScaleX, DashStyle.Solid);
            Brush    brush = TextFill.CreateBrush(new RectangleF(Parent.AbsLeft * e.ScaleX, Parent.AbsTop * e.ScaleY,
                                                                 Parent.Width * e.ScaleX, Parent.Height * e.ScaleY), e.ScaleX, e.ScaleY);

            sideTicksCount    = (MajorTicks.Count - 1) / 2;
            MajorTicks.Length = width / 12;

            SizeF maxTxt       = RadialUtils.GetStringSize(e, Parent, Font, Parent.Maximum.ToString());
            SizeF minTxt       = RadialUtils.GetStringSize(e, Parent, Font, Parent.Minimum.ToString());
            float maxTxtOffset = maxTxt.Height > maxTxt.Width ? maxTxt.Height : maxTxt.Width;
            float minTxtOffset = minTxt.Height > minTxt.Width ? minTxt.Height : minTxt.Width;

            majorTicksOffset = maxTxtOffset > minTxtOffset ? maxTxtOffset : minTxtOffset;

            PointF[] tick0 = new PointF[2];
            avrTick = new PointF(left + width / 2, top + majorTicksOffset);
            //first tick
            tick0[0] = avrTick;
            tick0[1] = new PointF(tick0[0].X, tick0[0].Y + MajorTicks.Length);

            double    angle      = 0;
            HorAlign  horAlign   = HorAlign.Middle;
            VertAlign vertAlign  = VertAlign.Bottom;
            double    startValue = avrValue;

            if (RadialUtils.IsSemicircle(Parent))
            {
                drawRight = true;
                drawLeft  = true;
                if (RadialUtils.IsBottom(Parent))
                {
                    angle       = 180 * RadialGauge.Radians;
                    horAlign    = HorAlign.Middle;
                    vertAlign   = VertAlign.Top;
                    majorStep  *= -1;
                    isRightPart = true;
                    isLeftPart  = false;
                }
                else if (RadialUtils.IsLeft(Parent))
                {
                    angle       = -90 * RadialGauge.Radians;
                    horAlign    = HorAlign.Right;
                    vertAlign   = VertAlign.Middle;
                    isRightPart = false;
                    isLeftPart  = false;
                }
                else if (RadialUtils.IsRight(Parent))
                {
                    angle       = 90 * RadialGauge.Radians;
                    horAlign    = HorAlign.Left;
                    vertAlign   = VertAlign.Middle;
                    majorStep  *= -1;
                    isRightPart = true; //false
                    isLeftPart  = true; // false
                }
            }


            else if (RadialUtils.IsQuadrant(Parent))
            {
                if (RadialUtils.IsTop(Parent) && RadialUtils.IsLeft(Parent))
                {
                    startValue = Parent.Maximum;
                    //angle = 180 * RadialGauge.Radians;
                    horAlign  = HorAlign.Middle;
                    vertAlign = VertAlign.Bottom;
                    //majorStep *= -1;
                    //isRightPart = true;
                    //isLeftPart = false;
                    drawRight = false;
                    drawLeft  = true;

                    isRightPart = false;
                    isLeftPart  = false;
                }
                else if (RadialUtils.IsBottom(Parent) && RadialUtils.IsLeft(Parent))
                {
                    startValue = Parent.Minimum;
                    angle      = 180 * RadialGauge.Radians;
                    horAlign   = HorAlign.Middle;
                    vertAlign  = VertAlign.Top;
                    drawRight  = true;
                    drawLeft   = false;

                    isRightPart = false;
                    isLeftPart  = false;
                }
                else if (RadialUtils.IsTop(Parent) && RadialUtils.IsRight(Parent))
                {
                    stepValue *= -1;
                    startValue = Parent.Maximum;
                    angle      = 0;
                    horAlign   = HorAlign.Middle;
                    vertAlign  = VertAlign.Bottom;
                    drawRight  = true;
                    drawLeft   = false;

                    isRightPart = true;
                    isLeftPart  = true;
                }
                else if (RadialUtils.IsBottom(Parent) && RadialUtils.IsRight(Parent))
                {
                    stepValue *= -1;
                    startValue = Parent.Minimum;
                    angle      = 180 * RadialGauge.Radians;
                    horAlign   = HorAlign.Middle;
                    vertAlign  = VertAlign.Top;
                    drawRight  = false;
                    drawLeft   = true;

                    isRightPart = true;
                    isLeftPart  = true;
                }
            }
            else
            {
                drawRight = true;
                drawLeft  = true;
            }

            tick0 = RadialUtils.RotateVector(tick0, angle, center);

            g.DrawLine(pen, tick0[0].X, tick0[0].Y, tick0[1].X, tick0[1].Y);
            string text = startValue.ToString();

            DrawText(e, text, brush, tick0[0].X, tick0[0].Y, horAlign, vertAlign);

            //rest of ticks
            PointF[] tick = new PointF[2];
            angle = majorStep * RadialGauge.Radians;

            for (int i = 0; i < sideTicksCount; i++)
            {
                //right side
                if (drawRight)
                {
                    tick = RadialUtils.RotateVector(tick0, angle, center);
                    g.DrawLine(pen, tick[0].X, tick[0].Y, tick[1].X, tick[1].Y);
                    text = Convert.ToString(Math.Round(startValue + stepValue * (i + 1)));

                    if (i == sideTicksCount / 2)
                    {
                        if (RadialUtils.IsSemicircle(Parent) || RadialUtils.IsQuadrant(Parent))
                        {
                            if (RadialUtils.IsLeft(Parent) && RadialUtils.IsTop(Parent))
                            {
                                horAlign  = HorAlign.Right;
                                vertAlign = VertAlign.Middle;
                            }
                            else if (RadialUtils.IsLeft(Parent) && RadialUtils.IsBottom(Parent))
                            {
                                horAlign  = HorAlign.Right;
                                vertAlign = VertAlign.Middle;
                            }
                            else if (RadialUtils.IsRight(Parent) && RadialUtils.IsTop(Parent))
                            {
                                horAlign  = HorAlign.Left;
                                vertAlign = VertAlign.Middle;
                            }
                            else if (RadialUtils.IsLeft(Parent))
                            {
                                horAlign  = HorAlign.Middle;
                                vertAlign = VertAlign.Bottom;
                            }
                            else if (RadialUtils.IsRight(Parent))
                            {
                                horAlign  = HorAlign.Middle;
                                vertAlign = VertAlign.Bottom;
                            }
                            else
                            {
                                horAlign  = HorAlign.Left;
                                vertAlign = VertAlign.Middle;
                            }
                        }
                        else
                        {
                            horAlign  = HorAlign.Left;
                            vertAlign = VertAlign.Middle;
                        }
                    }
                    else if (i < sideTicksCount / 2)
                    {
                        horAlign = HorAlign.Left;
                        if (RadialUtils.IsSemicircle(Parent) || RadialUtils.IsQuadrant(Parent))
                        {
                            if (RadialUtils.IsLeft(Parent) && RadialUtils.IsTop(Parent))
                            {
                                horAlign  = HorAlign.Right;
                                vertAlign = VertAlign.Middle;
                            }
                            if (RadialUtils.IsLeft(Parent) && RadialUtils.IsBottom(Parent))
                            {
                                vertAlign = VertAlign.Top;
                                horAlign  = HorAlign.Right;
                            }
                            else if (RadialUtils.IsBottom(Parent))
                            {
                                vertAlign = VertAlign.Top;
                            }
                            else if (RadialUtils.IsLeft(Parent))
                            {
                                horAlign  = HorAlign.Right;
                                vertAlign = VertAlign.Bottom;
                            }
                            else if (RadialUtils.IsRight(Parent))
                            {
                                horAlign  = HorAlign.Left;
                                vertAlign = VertAlign.Bottom;
                            }
                        }
                        else
                        {
                            vertAlign = VertAlign.Bottom;
                        }
                    }
                    else
                    {
                        horAlign  = HorAlign.Left;
                        vertAlign = VertAlign.Top;
                    }
                    txtPoint = GetTextPoint(tick, -1 * e.ScaleX, isNegative(i, true), isRightPart);
                    DrawText(e, text, brush, txtPoint.X, txtPoint.Y, horAlign, vertAlign);
                }

                if (drawLeft)
                {
                    //left side
                    angle *= -1;
                    tick   = RadialUtils.RotateVector(tick0, angle, center);
                    g.DrawLine(pen, tick[0].X, tick[0].Y, tick[1].X, tick[1].Y);
                    text = Convert.ToString(Math.Round(startValue - stepValue * (i + 1)));

                    if (i == sideTicksCount / 2)
                    {
                        if (RadialUtils.IsSemicircle(Parent) || RadialUtils.IsQuadrant(Parent))
                        {
                            if ((RadialUtils.IsTop(Parent) || RadialUtils.IsBottom(Parent)) && RadialUtils.IsSemicircle(Parent))
                            {
                                horAlign  = HorAlign.Right;
                                vertAlign = VertAlign.Middle;
                            }
                            else if (RadialUtils.IsLeft(Parent) && RadialUtils.IsTop(Parent))
                            {
                                horAlign  = HorAlign.Right;
                                vertAlign = VertAlign.Middle;
                            }
                            else if (RadialUtils.IsRight(Parent) && RadialUtils.IsBottom(Parent))
                            {
                                horAlign  = HorAlign.Left;
                                vertAlign = VertAlign.Middle;
                            }
                            else if (RadialUtils.IsLeft(Parent))
                            {
                                horAlign  = HorAlign.Middle;
                                vertAlign = VertAlign.Top;
                            }
                            else if (RadialUtils.IsRight(Parent))
                            {
                                horAlign  = HorAlign.Middle;
                                vertAlign = VertAlign.Top;
                            }
                        }
                        else
                        {
                            horAlign  = HorAlign.Right;
                            vertAlign = VertAlign.Middle;
                        }
                    }
                    else if (i < sideTicksCount / 2)
                    {
                        horAlign = HorAlign.Right;

                        if (RadialUtils.IsSemicircle(Parent) || RadialUtils.IsQuadrant(Parent))
                        {
                            if (RadialUtils.IsRight(Parent) && RadialUtils.IsBottom(Parent))
                            {
                                vertAlign = VertAlign.Top;
                                horAlign  = HorAlign.Left;
                            }
                            else if (RadialUtils.IsTop(Parent) && RadialUtils.IsLeft(Parent))
                            {
                                vertAlign = VertAlign.Bottom;
                                horAlign  = HorAlign.Right;
                            }
                            else if (RadialUtils.IsBottom(Parent))
                            {
                                vertAlign = VertAlign.Top;
                            }
                            else if (RadialUtils.IsLeft(Parent))
                            {
                                horAlign  = HorAlign.Right;
                                vertAlign = VertAlign.Top;
                            }
                            else if (RadialUtils.IsRight(Parent))
                            {
                                horAlign  = HorAlign.Left;
                                vertAlign = VertAlign.Top;
                            }
                        }
                        else
                        {
                            vertAlign = VertAlign.Bottom;
                        }
                    }
                    else
                    {
                        horAlign  = HorAlign.Right;
                        vertAlign = VertAlign.Top;
                    }
                    txtPoint = GetTextPoint(tick, -1 * e.ScaleX, isNegative(i, false), isLeftPart);
                    DrawText(e, text, brush, txtPoint.X, txtPoint.Y, horAlign, vertAlign);
                    angle *= -1;
                }

                angle += majorStep * RadialGauge.Radians;
            }
        }