ConvertComboBoxStateToButtonState() private static method

Converts the specified ComboBoxStates value to a ButtonState value
private static ConvertComboBoxStateToButtonState ( ComboBoxStates state ) : ButtonState
state ComboBoxStates The ComboBoxStates value to be converted
return ButtonState
Exemplo n.º 1
0
        /// <summary>
        /// Draws a combobox button in the specified state, on the specified graphics
        /// surface, and within the specified bounds
        /// </summary>
        /// <param name="g">The Graphics to draw on</param>
        /// <param name="buttonRect">The Rectangle that represents the dimensions
        /// of the button</param>
        /// <param name="clipRect">The Rectangle that represents the clipping area</param>
        /// <param name="state">A ComboBoxStates value that specifies the
        /// state to draw the combobox button in</param>
        public static void DrawComboBoxButton(Graphics g, Rectangle buttonRect, Rectangle clipRect, ComboBoxStates state)
        {
            if (g == null || buttonRect.Width <= 0 || buttonRect.Height <= 0 || clipRect.Width <= 0 || clipRect.Height <= 0)
            {
                return;
            }

            if (ThemeManager.VisualStylesEnabled)
            {
                ThemeManager.DrawThemeBackground(g, ThemeClasses.ComboBox, (int)ComboBoxParts.DropDownButton, (int)state, buttonRect, clipRect);
            }
            else
            {
                ControlPaint.DrawComboButton(g, buttonRect, ThemeManager.ConvertComboBoxStateToButtonState(state));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Draws a combobox button in the specified state, on the specified graphics
        /// surface, and within the specified bounds
        /// </summary>
        /// <param name="g">The Graphics to draw on</param>
        /// <param name="buttonRect">The Rectangle that represents the dimensions
        /// of the button</param>
        /// <param name="clipRect">The Rectangle that represents the clipping area</param>
        /// <param name="state">A ComboBoxState value that specifies the
        /// state to draw the combobox button in</param>
        public static void DrawComboBoxButton(Graphics g, Rectangle buttonRect, Rectangle clipRect, ComboBoxState state)
        {
            if (g == null || buttonRect.Width <= 0 || buttonRect.Height <= 0 || clipRect.Width <= 0 || clipRect.Height <= 0)
            {
                return;
            }

            if (ThemeManager.VisualStylesEnabled)
            {
                //ThemeManager.DrawThemeBackground(g, ThemeClasses.ComboBox, (int) ComboBoxParts.DropDownButton, (int) state, buttonRect, clipRect);
                VisualStyleRenderer renderer;
                switch (state)
                {
                case ComboBoxState.Disabled:
                    renderer = new VisualStyleRenderer(VisualStyleElement.ComboBox.DropDownButton.Disabled);
                    break;

                case ComboBoxState.Hot:
                    renderer = new VisualStyleRenderer(VisualStyleElement.ComboBox.DropDownButton.Hot);
                    break;

                case ComboBoxState.Pressed:
                    renderer = new VisualStyleRenderer(VisualStyleElement.ComboBox.DropDownButton.Pressed);
                    break;

                case ComboBoxState.Normal:
                default:
                    renderer = new VisualStyleRenderer(VisualStyleElement.ComboBox.DropDownButton.Normal);
                    break;
                }
                renderer.DrawBackground(g, buttonRect, clipRect);
            }
            else
            {
                ControlPaint.DrawComboButton(g, buttonRect, ThemeManager.ConvertComboBoxStateToButtonState(state));
            }
        }