}
#endregion // ButtonBase
- #region ComboBox
-
- // Drawing
- public override void DrawComboBoxEditDecorations( Graphics dc, ComboBox ctrl, Rectangle cl ) {
-
- Color inner_border = (ctrl.Focused && !ctrl.DroppedDown) ? combobox_focus_inner_border_color : Color.White; // Color.White should be the backcolor of the textctrl
- Color border_color = (ctrl.Focused && !ctrl.DroppedDown) ? combobox_focus_border_color : combobox_border_color;
-
- Point[] border_points = null;
-
- Pen tmp_pen = ResPool.GetPen( inner_border );
-
- dc.DrawLine( tmp_pen, cl.X + 1, cl.Y + 1, cl.X + 1, cl.Bottom - 2 );
-
- if (!ctrl.Focused || (ctrl.Focused && ctrl.DropDownStyle == ComboBoxStyle.Simple))
- {
- dc.DrawLine( tmp_pen, cl.X + 2, cl.Y + 1, cl.Right - 2, cl.Y + 1 );
- dc.DrawLine( tmp_pen, cl.X + 2, cl.Bottom - 2, cl.Right - 2, cl.Bottom - 2 );
- dc.DrawLine( tmp_pen, cl.Right - 2, cl.Y + 1, cl.Right - 2, cl.Bottom - 2 );
- } else {
- dc.DrawLine( tmp_pen, cl.X + 2, cl.Y + 1, cl.Right - ctrl.combobox_info.button_rect.Width - 3, cl.Y + 1 );
- dc.DrawLine( tmp_pen, cl.X + 2, cl.Bottom - 2, cl.Right - ctrl.combobox_info.button_rect.Width - 3, cl.Bottom - 2 );
- }
- if (ctrl.combobox_info.show_button) {
- border_points = new Point[6] {
- new Point( cl.Right - ctrl.combobox_info.button_rect.Width - 3, cl.Y ),
- new Point( cl.X + 2, cl.Y ),
- new Point( cl.X, cl.Y + 2 ),
- new Point( cl.X, cl.Bottom - 3 ),
- new Point( cl.X + 2, cl.Bottom - 1 ),
- new Point( cl.Right - ctrl.combobox_info.button_rect.Width - 3, cl.Bottom - 1 )
- };
- } else {
- border_points = new Point[9] {
- new Point( cl.X + 2, cl.Y ),
- new Point( cl.Right - 3, cl.Y ),
- new Point( cl.Right - 1, cl.Y + 2 ),
- new Point( cl.Right - 1, cl.Bottom - 3 ),
- new Point( cl.Right - 3, cl.Bottom - 1 ),
- new Point( cl.X + 2, cl.Bottom - 1 ),
- new Point( cl.X, cl.Bottom - 3 ),
- new Point( cl.X, cl.Y + 2 ),
- new Point( cl.X + 2, cl.Y )
- };
- }
-
- tmp_pen = ResPool.GetPen( ctrl.Parent.BackColor );
- dc.DrawLine( tmp_pen, cl.X, cl.Y, cl.X, cl.Y + 1 );
- dc.DrawLine( tmp_pen, cl.X, cl.Bottom - 1, cl.X, cl.Bottom - 2 );
- dc.DrawLine( tmp_pen, cl.Right - 1, cl.Y, cl.Right - 1, cl.Y + 1 );
- dc.DrawLine( tmp_pen, cl.Right - 1, cl.Bottom - 1, cl.Right - 1, cl.Bottom - 2 );
-
- dc.DrawLines( ResPool.GetPen( border_color ), border_points );
-
- tmp_pen = ResPool.GetPen( edge_bottom_inner_color );
- dc.DrawLine( tmp_pen, cl.X, cl.Y + 1, cl.X + 1, cl.Y );
- dc.DrawLine( tmp_pen, cl.X, cl.Bottom - 2, cl.X + 1, cl.Bottom - 1 );
- dc.DrawLine( tmp_pen, cl.Right - 2, cl.Y, cl.Right - 1, cl.Y + 1 );
- dc.DrawLine( tmp_pen, cl.Right - 2, cl.Bottom - 1, cl.Right - 1, cl.Bottom - 2 );
-
- // FIXME:
- // here we need to draw the combobox button again,
- // as DrawComboBoxEditDecorations paints over a fullsize combox button.
- // ComboBox code calls CPDrawComboButton first then DrawComboBoxEditDecorations
- // It would be better to move that code out of ComboBox
-
- if ( ctrl.combobox_info.show_button )
- {
- control_parent_backcolor = ctrl.Parent.BackColor;
-
- ButtonState bs = ctrl.Enabled ? ctrl.combobox_info.button_status : ButtonState.Inactive;
-
- Rectangle crect = new Rectangle( ctrl.combobox_info.button_rect.X, ctrl.combobox_info.button_rect.Y - 2,
- ctrl.combobox_info.button_rect.Width + 2, ctrl.combobox_info.button_rect.Height + 4 );
- CPDrawComboButton( dc, crect, bs );
- }
- }
-
- public override void DrawComboListBoxDecorations( Graphics dc, ComboBox ctrl, Rectangle cl ) {
- if ( ctrl.DropDownStyle == ComboBoxStyle.Simple ) {
- DrawComboBoxEditDecorations( dc, ctrl, cl );
- } else {
- dc.DrawRectangle( ResPool.GetPen( combobox_border_color ), cl.X, cl.Y, cl.Width - 1, cl.Height - 1 );
- }
- }
- #endregion ComboBox
-
#region Menus
public override void DrawMenuItem( MenuItem item, DrawItemEventArgs e ) {
StringFormat string_format;