/// <summary>
        /// gets knob position that is to be drawn on control minus a small amount in order that the knob position stay inside the circle.
        /// </summary>
        /// <returns>Point that describes current knob position</returns>
        private Point GetKnobPosition(int l)
        {
            float cx = _pKnob.X;
            float cy = _pKnob.Y;

            // FAB: 21/08/18
            float degree = _deltaAngle * (this.Value - _minimum) / (_maximum - _minimum);

            degree = KryptonKnobUtilities.GetRadian(degree + _startAngle);

            Point Pos = new Point(0, 0)
            {
                X = (int)(cx + l * Math.Cos(degree)),
                Y = (int)(cy + l * Math.Sin(degree))
            };

            return(Pos);
        }
        /// <summary>
        /// Draw graduations
        /// </summary>
        /// <param name="Gr"></param>
        /// <param name="rc">Knob rectangle</param>
        /// <returns></returns>
        private bool DrawDivisions(Graphics Gr, RectangleF rc)
        {
            if (this == null)
            {
                return(false);
            }

            float cx = _pKnob.X;
            float cy = _pKnob.Y;

            float w = rc.Width;
            float h = rc.Height;

            float tx;
            float ty;

            float incr         = KryptonKnobUtilities.GetRadian((_endAngle - _startAngle) / ((_scaleDivisions - 1) * (_scaleSubDivisions + 1)));
            float currentAngle = KryptonKnobUtilities.GetRadian(_startAngle);

            float radius     = (float)(rc.Width / 2);
            float rulerValue = (float)_minimum;

            Font font;

            Pen penL = new Pen(_scaleColour, (2 * _drawRatio));
            Pen penS = new Pen(_scaleColour, (1 * _drawRatio));

            SolidBrush br = new SolidBrush(_scaleColour);

            PointF ptStart = new PointF(0, 0);
            PointF ptEnd   = new PointF(0, 0);
            int    n       = 0;

            if (_showLargeScale)
            {
                // Size of maxi string
                string strvalmax = _maximum.ToString();
                string strvalmin = _minimum.ToString();
                string strval    = strvalmax.Length > strvalmin.Length ? strvalmax : strvalmin;
                double val       = Convert.ToDouble(strval);
                //double val = _maximum;
                String str = String.Format("{0,0:D}", (int)val);
                float  fSize;
                SizeF  strsize;

                if (_scaleTypefaceAutoSize)
                {
                    fSize = (float)(6F * _drawRatio);
                    if (fSize < 6)
                    {
                        fSize = 6;
                    }
                }
                else
                {
                    fSize = _scaleTypeface.Size;
                }

                font    = new Font(_scaleTypeface.FontFamily, fSize);
                strsize = Gr.MeasureString(str, font);

                int strw = (int)strsize.Width;
                int strh = (int)strsize.Height;
                int wmax = Math.Max(strw, strh);

                float l = 0;
                _gradLength = 2 * _drawRatio;

                for (; n < _scaleDivisions; n++)
                {
                    // draw divisions
                    ptStart.X = (float)(cx + (radius) * Math.Cos(currentAngle));
                    ptStart.Y = (float)(cy + (radius) * Math.Sin(currentAngle));

                    ptEnd.X = (float)(cx + (radius + _gradLength) * Math.Cos(currentAngle));
                    ptEnd.Y = (float)(cy + (radius + _gradLength) * Math.Sin(currentAngle));

                    Gr.DrawLine(penL, ptStart, ptEnd);


                    //Draw graduation values
                    val = Math.Round(rulerValue);
                    str = String.Format("{0,0:D}", (int)val);

                    // If autosize
                    if (_scaleTypefaceAutoSize)
                    {
                        strsize = Gr.MeasureString(str, new Font(_scaleTypeface.FontFamily, fSize));
                    }
                    else
                    {
                        strsize = Gr.MeasureString(str, new Font(_scaleTypeface.FontFamily, _scaleTypeface.Size));
                    }



                    if (_drawDivInside)
                    {
                        // graduations values inside the knob
                        l = (int)radius - (wmax / 2) - 2;

                        tx = (float)(cx + l * Math.Cos(currentAngle));
                        ty = (float)(cy + l * Math.Sin(currentAngle));
                    }
                    else
                    {
                        // graduation values outside the knob
                        //l = (Width / 2) - (wmax / 2) ;
                        l = radius + _gradLength + wmax / 2;

                        tx = (float)(cx + l * Math.Cos(currentAngle));
                        ty = (float)(cy + l * Math.Sin(currentAngle));
                    }

                    Gr.DrawString(str,
                                  font,
                                  br,
                                  tx - (float)(strsize.Width * 0.5),
                                  ty - (float)(strsize.Height * 0.5));



                    rulerValue += (float)((_maximum - _minimum) / (_scaleDivisions - 1));

                    if (n == _scaleDivisions - 1)
                    {
                        break;
                    }


                    // Subdivisions
                    #region SubDivisions

                    if (_scaleDivisions <= 0)
                    {
                        currentAngle += incr;
                    }
                    else
                    {
                        for (int j = 0; j <= _scaleSubDivisions; j++)
                        {
                            currentAngle += incr;

                            // if user want to display small graduations
                            if (_showSmallScale)
                            {
                                ptStart.X = (float)(cx + radius * Math.Cos(currentAngle));
                                ptStart.Y = (float)(cy + radius * Math.Sin(currentAngle));
                                ptEnd.X   = (float)(cx + (radius + _gradLength / 2) * Math.Cos(currentAngle));
                                ptEnd.Y   = (float)(cy + (radius + _gradLength / 2) * Math.Sin(currentAngle));

                                Gr.DrawLine(penS, ptStart, ptEnd);
                            }
                        }
                    }
                    #endregion
                }
                font.Dispose();
            }

            return(true);
        }
        /// <summary>
        /// return 2 points of a line starting from the center of the knob to the periphery
        /// </summary>
        /// <param name="l"></param>
        /// <returns></returns>
        private Point[] GetKnobLine(Graphics Gr, int l)
        {
            Point[] pret = new Point[2];

            float cx = _pKnob.X;
            float cy = _pKnob.Y;


            float radius = (float)(_rKnob.Width / 2);

            // FAB: 21/08/18
            float degree = _deltaAngle * (this.Value - _minimum) / (_maximum - _minimum);

            degree = KryptonKnobUtilities.GetRadian(degree + _startAngle);


            double val = _maximum;
            String str = String.Format("{0,0:D}", (int)val);
            float  fSize;
            SizeF  strsize;

            if (!_scaleTypefaceAutoSize)
            {
                fSize   = _scaleTypeface.Size;
                strsize = Gr.MeasureString(str, _scaleTypeface);
            }
            else
            {
                fSize = (float)(6F * _drawRatio);
                if (fSize < 6)
                {
                    fSize = 6;
                }

                _knobTypeface = new Font(_scaleTypeface.FontFamily, fSize);
                strsize       = Gr.MeasureString(str, _knobTypeface);
            }

            int strw = (int)strsize.Width;
            int strh = (int)strsize.Height;
            int w    = Math.Max(strw, strh);


            Point Pos = new Point(0, 0);

            if (_drawDivInside)
            {
                // Center (from)
                Pos.X   = (int)(cx + (radius / 10) * Math.Cos(degree));
                Pos.Y   = (int)(cy + (radius / 10) * Math.Sin(degree));
                pret[0] = new Point(Pos.X, Pos.Y);

                // External (to)
                Pos.X   = (int)(cx + (radius - w) * Math.Cos(degree));
                Pos.Y   = (int)(cy + (radius - w) * Math.Sin(degree));
                pret[1] = new Point(Pos.X, Pos.Y);
            }
            else
            {
                // Internal (from)
                Pos.X = (int)(cx + (radius - _drawRatio * 10 - l) * Math.Cos(degree));
                Pos.Y = (int)(cy + (radius - _drawRatio * 10 - l) * Math.Sin(degree));


                pret[0] = new Point(Pos.X, Pos.Y);

                // External (to)
                Pos.X = (int)(cx + (radius - 4) * Math.Cos(degree));
                Pos.Y = (int)(cy + (radius - 4) * Math.Sin(degree));

                pret[1] = new Point(Pos.X, Pos.Y);
            }
            return(pret);
        }