示例#1
0
        /// <summary>
        /// Converts the specified ComboBoxStates value to a ButtonState value
        /// </summary>
        /// <param name="state">The ComboBoxStates value to be converted</param>
        /// <returns>A ButtonState value that represents the specified ComboBoxStates
        /// value</returns>
        private static ButtonState ConvertComboBoxStateToButtonState(ComboBoxStates state)
        {
            switch (state)
            {
            case ComboBoxStates.Pressed:
            {
                return(ButtonState.Pushed);
            }

            case ComboBoxStates.Disabled:
            {
                return(ButtonState.Inactive);
            }
            }

            return(ButtonState.Normal);
        }
        /// <summary>
        /// Paints the Cells background
        /// </summary>
        /// <param name="e">A PaintCellEventArgs that contains the event data</param>
        protected override void OnPaintBackground(PaintCellEventArgs e)
        {
            base.OnPaintBackground(e);

            // don't bother going any further if the Cell is null
            if (e.Cell == null)
            {
                return;
            }

            if (this.ShowDropDownButton || (e.Table.IsEditing && e.CellPos == e.Table.EditingCell))
            {
                ComboBoxStates state = this.GetDropDownRendererData(e.Cell).ButtonState;

                if (!e.Enabled)
                {
                    state = ComboBoxStates.Disabled;
                }

                ThemeManager.DrawComboBoxButton(e.Graphics, this.CalcDropDownButtonBounds(), state);
            }
        }
示例#3
0
        /// <summary>
        /// Draws a combo box button - need to fix Combobox.cs
        /// </summary>
        public override void DrawComboButton(Graphics graphics, int x, int y,
                                             int width, int height, ButtonState state)
        {
            // revert to default theme if necessary
            if (!enableTheme)             // && FlatStyle.System
            {
                base.DrawComboButton(graphics, x, y, width, height, state);
                return;
            }

            ComboBoxStates ctlState = ComboBoxStates.CBXS_NORMAL;

            if ((state & ButtonState.Flat) != 0)
            {
                ctlState = ComboBoxStates.CBXS_HOT;
            }
            if ((state & ButtonState.Pushed) != 0)
            {
                ctlState = ComboBoxStates.CBXS_PRESSED;
            }

            Theme.DrawControl(graphics, "ComboBox", x, y, width, height,
                              (int)ComboBoxParts.CP_DROPDOWNBUTTON, (int)ctlState);
        }
示例#4
0
 public static void DrawButton(Graphics g, Rectangle buttonRect, ComboBoxStates state)
 {
     ThemeManager.DrawButton(g, buttonRect, buttonRect, (PushButtonStates)state);
 }
示例#5
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));
            }
        }
示例#6
0
 /// <summary>
 /// Initializes a new instance of the DropDownRendererData class
 /// </summary>
 public DropDownRendererData()
 {
     this.buttonState = ComboBoxStates.Normal;
     this.clickX      = -1;
     this.clickY      = -1;
 }
		/// <summary>
		/// Initializes a new instance of the DropDownRendererData class
		/// </summary>
		public DropDownRendererData()
		{
			this.buttonState = ComboBoxStates.Normal;
			this.clickX = -1;
			this.clickY = -1;
		}
		/// <summary>
		/// Converts the specified ComboBoxStates value to a ButtonState value
		/// </summary>
		/// <param name="state">The ComboBoxStates value to be converted</param>
		/// <returns>A ButtonState value that represents the specified ComboBoxStates 
		/// value</returns>
		private static ButtonState ConvertComboBoxStateToButtonState(ComboBoxStates state)
		{
			switch (state)
			{
				case ComboBoxStates.Pressed:
				{
					return ButtonState.Pushed;
				}

				case ComboBoxStates.Disabled:
				{
					return ButtonState.Inactive;
				}
			}

			return ButtonState.Normal;
		}
		/// <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));
			}
		}
		/// <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 combobox button</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, ComboBoxStates state)
		{
			ThemeManager.DrawComboBoxButton(g, buttonRect, buttonRect, state);
		}