/// <summary>
 /// Returns pointer size of pointer style.
 /// </summary>
 public static int PointerSize(this PointerStyle pointerStyle)
 {
     if (pointerStyle == PointerStyle.qwAbsolute || pointerStyle == PointerStyle.qwRelative)
     {
         return(8);
     }
     return(4);
 }
Esempio n. 2
0
        /// <inheritdoc />
        /// <summary>Initializes a new instance of the <see cref="T:VisualPlus.Toolkit.Controls.Interactivity.VisualKnob" /> class.</summary>
        public VisualKnob()
        {
            SetStyle(
                ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor,
                true);

            StyleManager styleManager = new StyleManager(Settings.DefaultValue.DefaultStyle);

            _pointerColor = styleManager.Theme.OtherSettings.Progress;

            UpdateStyles();
            _knobFont = Font;
            ForeColor = Color.DimGray;

            _buttonDivisions         = 30;
            _components              = null;
            _endAngle                = 405;
            _knobDistance            = 35;
            _knobSize                = new Size(90, 90);
            _knobTickSize            = new Size(86, 86);
            _knobTopSize             = new Size(75, 75);
            _largeChange             = 5;
            _lineSize                = new Size(1, 1);
            _maximum                 = 100;
            _mouseWheelBarPartitions = 10;
            _pointerStyle            = PointerStyle.Circle;
            _scaleDivisions          = 11;
            _scaleSubDivisions       = 4;
            _showLargeScale          = true;
            _showSmallScale          = true;
            _smallChange             = 1;
            _startAngle              = 135;
            _tickColor               = Color.DimGray;
            _valueVisible            = true;

            _knobBorder    = new Border();
            _knobTopBorder = new Border {
                HoverVisible = false
            };

            InitializeGradient();
            InitializeComponent();

            // "start angle" and "end angle" possible values:

            // 90 = bottom (minimum value for "start angle")
            // 180 = left
            // 270 = top
            // 360 = right
            // 450 = bottom again (maximum value for "end angle")

            // So the couple (90, 450) will give an entire circle and the couple (180, 360) will give half a circle.
            _deltaAngle = _endAngle - _startAngle;
            ConfigureDimensions();
        }