Ejemplo n.º 1
0
        /// <summary>
        /// Draws the knob indicator.
        /// </summary>
        /// <param name="Gr">The gr.</param>
        /// <param name="rc">The rc.</param>
        /// <param name="pos">The position.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
        public virtual bool DrawKnobIndicator(Graphics Gr, RectangleF rc, PointF pos)
        {
            if (this.Knob == null)
            {
                return(false);
            }

            RectangleF _rc = rc;

            _rc.X      = pos.X - 4;
            _rc.Y      = pos.Y - 4;
            _rc.Width  = 8;
            _rc.Height = 8;

            Color cKnob     = this.Knob.IndicatorColor;
            Color cKnobDark = ZeroitLBColorManager.StepColor(cKnob, 60);

            LinearGradientBrush br = new LinearGradientBrush(_rc, cKnobDark, cKnob, 45);

            Gr.FillEllipse(br, _rc);

            br.Dispose();

            return(true);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Draw the knob of the control
        /// </summary>
        /// <param name="Gr">The gr.</param>
        /// <param name="rc">The rc.</param>
        /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns>
        public virtual bool DrawKnob(Graphics Gr, RectangleF rc)
        {
            if (this.Knob == null)
            {
                return(false);
            }

            Color cKnob     = this.Knob.KnobColor;
            Color cKnobDark = ZeroitLBColorManager.StepColor(cKnob, 60);

            LinearGradientBrush br = new LinearGradientBrush(rc, cKnob, cKnobDark, 45);

            Gr.FillEllipse(br, rc);

            br.Dispose();

            return(true);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Steps the color.
        /// </summary>
        /// <param name="clr">The color.</param>
        /// <param name="alpha">The alpha.</param>
        /// <returns>Color.</returns>
        public static Color StepColor(Color clr, int alpha)
        {
            if (alpha == 100)
            {
                return(clr);
            }

            byte  a  = clr.A;
            byte  r  = clr.R;
            byte  g  = clr.G;
            byte  b  = clr.B;
            float bg = 0;

            int _alpha = Math.Min(alpha, 200);

            _alpha = Math.Max(alpha, 0);
            double ialpha = ((double)(_alpha - 100.0)) / 100.0;

            if (ialpha > 100)
            {
                // blend with white
                bg     = 255.0F;
                ialpha = 1.0F - ialpha;  // 0 = transparent fg; 1 = opaque fg
            }
            else
            {
                // blend with black
                bg     = 0.0F;
                ialpha = 1.0F + ialpha;  // 0 = transparent fg; 1 = opaque fg
            }

            r = (byte)(ZeroitLBColorManager.BlendColour(r, bg, ialpha));
            g = (byte)(ZeroitLBColorManager.BlendColour(g, bg, ialpha));
            b = (byte)(ZeroitLBColorManager.BlendColour(b, bg, ialpha));

            return(Color.FromArgb(a, r, g, b));
        }