Пример #1
0
 /// <summary>Initializes a new instance of the <see cref="TextStyle" /> class.</summary>
 public TextStyle()
 {
     textColorState    = new ControlColorState();
     textRenderingHint = DefaultConstants.TextRenderingHint;
     textAlignment     = StringAlignment.Center;
     textLineAlignment = StringAlignment.Center;
 }
Пример #2
0
        /// <summary>Initializes a new instance of the <see cref="TextStyle" /> class.</summary>
        /// <param name="colorState">The color State.</param>
        public TextStyle(ControlColorState colorState) : this()
        {
            if (colorState.IsEmpty)
            {
                throw new ArgumentNullException(nameof(colorState));
            }

            textColorState = colorState;
        }
Пример #3
0
        /// <summary>Get the control back color state.</summary>
        /// <param name="controlColorState">The control color state.</param>
        /// <param name="enabled">The enabled toggle.</param>
        /// <param name="mouseState">The mouse state.</param>
        /// <returns>The <see cref="Color" />.</returns>
        public static Color BackColorState(ControlColorState controlColorState, bool enabled, MouseStates mouseState)
        {
            Color _color;

            if (enabled)
            {
                switch (mouseState)
                {
                case MouseStates.Normal:
                {
                    _color = controlColorState.Enabled;
                    break;
                }

                case MouseStates.Hover:
                {
                    _color = controlColorState.Hover;
                    break;
                }

                case MouseStates.Pressed:
                {
                    _color = controlColorState.Pressed;
                    break;
                }

                default:
                {
                    throw new ArgumentOutOfRangeException(nameof(mouseState), mouseState, null);
                }
                }
            }
            else
            {
                _color = controlColorState.Disabled;
            }

            return(_color);
        }