[Mono-winforms-list] Patch: Button Fixes PartII -> FlatStyle fixes

John BouAntoun jba-mono@optusnet.com.au
Sun, 31 Oct 2004 17:51:16 +1100


--=-7/gcI9ksrK1ro3wtyPaQ
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi guys,

I've managed to finally complete my journey of correcting flatstyle
rendering and behaviour for the button, radiobutton and checkbox.

I have already sent in two other patches that were meant to help
progress to this point (my last two patches to the list) but they
haven't been checked in yet. Unfortunately because they haven't been
checked in yet, this diff is very large and includes those previous
patches (and edit's i've made to the patch sections since sending them
in).

The changes since the last patch are as follows:

- Fix Button rendering for FlatStyle = Flat or Popup
- Fix RadioButton and CheckBox rendering when Appearance = Button
(normal and flatstyle).

However the other fixes that this patch includes (i.e. from my last two
patches) are:

        Last patch:
        1) Correct outer rectangle color when drawing focus rectangle
        2) Adjust button bounds to be 1 px smaller when focused
        3) Make button not draw sunken 3d border when pushed (windows
        compat)
        4) Fix CPDrawBorder3D to not make bottom right hand corner
        rounded
        (extend border right to corner)
        5) Offset the text in RadioButton and Checkbox when being
        rendered as a
        button.
        
        Patch Before that:
        1) Hover and Click behaviour for Colored FlatStyle.Flat
        radiobuttons
        2) Hover and click behaviour for Colored FlatStyle.Popup
        radiobuttons
        3) Disabled rendering fixes for colored flatstyle radiobuttons
        (both)
        4) Disabled text rendering for all radiobuttons
        
Enjoy the button flat style goodness!!

There is only one more thing left to do for button rendering, and that
is to render the dashed focus rectangle, but I have a few issues with
that one waiting on a response (in the mailing list).

JBA


--=-7/gcI9ksrK1ro3wtyPaQ
Content-Disposition: attachment; filename=ButtonFlatStyleFixes.patch
Content-Type: text/x-patch; name=ButtonFlatStyleFixes.patch; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

? ButtonFlatStyleFixes.patch
? Makefile.SWF
? Makefile.solution.SWF
? SWF.cmbx
? SWF.mdsx
? SWF.pidb
? SWF.prjx
? make.sh
Index: System.Windows.Forms/ThemeWin32Classic.cs
===================================================================
RCS file: /cvs/public/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ThemeWin32Classic.cs,v
retrieving revision 1.52
diff -u -r1.52 ThemeWin32Classic.cs
--- System.Windows.Forms/ThemeWin32Classic.cs	30 Oct 2004 10:23:02 -0000	1.52
+++ System.Windows.Forms/ThemeWin32Classic.cs	31 Oct 2004 05:17:16 -0000
@@ -320,6 +320,7 @@
 		public override void DrawButtonBase(Graphics dc, Rectangle clip_area, ButtonBase button) {
 			int		width;
 			int		height;
+			Rectangle buttonRectangle;
 
 			width = button.ClientSize.Width;
 			height = button.ClientSize.Height;
@@ -327,13 +328,31 @@
 			SolidBrush	sb = new SolidBrush(button.BackColor);
 			dc.FillRectangle(sb, button.ClientRectangle);
 			sb.Dispose();
-
-			CPDrawButton(dc, button.ClientRectangle, button.ButtonState);
-
-			if (button.has_focus) {
-				CPDrawFocusRectangle(dc, button.ClientRectangle, ColorButtonText, ColorButtonFace);
+			
+			// set up the button rectangle
+			buttonRectangle = button.ClientRectangle;
+			if (button.has_focus || button.Capture) {
+				Color focusRectColor = button.ForeColor;
+				// adjust focus color according to the flatstyle
+				if (button.FlatStyle == FlatStyle.Popup && !button.is_pressed) {
+					focusRectColor = (button.BackColor == ColorButtonFace) ? ControlPaint.Dark(ColorButtonFace) : ColorButtonText;
+				} 
+				
+				// draw the outer focus rectangle
+				dc.DrawRectangle(ResPool.GetPen(focusRectColor), buttonRectangle);
+				
+				// shrink the rectangle for the normal button drawing inside the focus rectangle
+				buttonRectangle = new Rectangle (buttonRectangle.X + 1, buttonRectangle.Y + 1, Math.Max(buttonRectangle.Width-2, 0), Math.Max(buttonRectangle.Height-2, 0));
 			}
 
+			if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) {
+				DrawFlatStyleButton (dc, buttonRectangle, button);
+			} else {
+				CPDrawButton(dc, buttonRectangle, button.ButtonState);
+			}
+			
+			// TODO: draw the inner focus rectangle
+							
 			// First, draw the image
 			if ((button.image != null) || (button.image_list != null)) {
 				// Need to draw a picture
@@ -440,7 +459,100 @@
 					dc.DrawString(button.text, button.Font, b, text_rect, button.text_format);
 					b.Dispose();
 				} else {
-					CPDrawStringDisabled(dc, button.text, button.Font, ColorButtonText, text_rect, button.text_format);
+					if (button.FlatStyle == FlatStyle.Flat || button.FlatStyle == FlatStyle.Popup) {
+						dc.DrawString(button.text, button.Font, ResPool.GetSolidBrush (ControlPaint.DarkDark (this.ColorButtonFace)), text_rect, button.text_format);
+					} else {
+						CPDrawStringDisabled(dc, button.text, button.Font, ColorButtonText, text_rect, button.text_format);
+					}
+				}
+			}
+		}
+		
+		// draw the flat style part of the rectangle
+		public void DrawFlatStyleButton (Graphics graphics, Rectangle rectangle, ButtonBase button) {
+			Color rect_back_color = button.BackColor;
+			Color rect_fore_color = button.ForeColor;
+				
+			if (button.Enabled) {
+				if (button.Capture || button.is_entered) {
+					if (button.FlatStyle == FlatStyle.Flat) {
+						// fill the rectangle
+						graphics.FillRectangle (ResPool.GetSolidBrush (rect_back_color), rectangle);
+						
+						// now draw the outer border
+						if (button.Capture && button.is_entered) {
+							rect_back_color = ControlPaint.LightLight (rect_back_color);
+						} else {
+							rect_back_color = ControlPaint.Light (rect_back_color);
+						}
+						
+						// draw rectangle and fill it
+						graphics.FillRectangle (ResPool.GetSolidBrush (rect_back_color), rectangle);
+						graphics.DrawRectangle(ResPool.GetPen (rect_fore_color), rectangle);
+					} else {
+						// else it must be a popup button
+						
+						if (button.Capture && button.is_entered) {
+							graphics.DrawRectangle(ResPool.GetPen (this.ColorButtonText), rectangle);
+						} else {
+							// draw a 3d border
+							graphics.DrawLine ( ResPool.GetPen (ControlPaint.LightLight (rect_back_color)), rectangle.X, rectangle.Y, rectangle.Right-1, rectangle.Y);
+							graphics.DrawLine ( ResPool.GetPen (ControlPaint.LightLight (rect_back_color)), rectangle.X, rectangle.Y, rectangle.X, rectangle.Height-1);
+							graphics.DrawLine ( ResPool.GetPen (this.ColorButtonText), rectangle.X, rectangle.Bottom, rectangle.Width, rectangle.Bottom);
+							graphics.DrawLine ( ResPool.GetPen (this.ColorButtonText), rectangle.Right, rectangle.Y, rectangle.Right, rectangle.Bottom);
+						}
+					}
+					
+					// TODO: draw inner focus rectangle
+					
+				} else {
+					// popup has a ButtonColorText forecolor, not a button.ForeCOlor
+					if (button.FlatStyle == FlatStyle.Popup) {
+						rect_fore_color = this.ColorButtonText;
+					}
+					
+					// fill then draw outer rect
+					graphics.FillRectangle (ResPool.GetSolidBrush (rect_back_color), rectangle);
+					graphics.DrawRectangle(ResPool.GetPen (rect_fore_color), rectangle);
+					
+					// TODO: draw inner focus rectangle
+				}
+				
+				// finally some small tweaks to render radiobutton and checkbox
+				CheckBox checkbox = button as CheckBox;
+				RadioButton radiobutton = button as RadioButton;
+				if ((checkbox != null && checkbox.Checked) ||
+					(radiobutton != null && radiobutton.Checked)) {
+					if (button.FlatStyle == FlatStyle.Flat && button.is_entered && !button.Capture) {
+						// render the hover for flat flatstyle and cheked
+						graphics.DrawRectangle(ResPool.GetPen (this.ColorButtonText), rectangle);
+					} else if (!button.is_entered && !button.Capture) {
+						// render the checked state for popup when unhovered
+						graphics.DrawLine ( ResPool.GetPen (ControlPaint.LightLight (button.BackColor)), rectangle.X, rectangle.Bottom, rectangle.Right, rectangle.Bottom);
+						graphics.DrawLine ( ResPool.GetPen (ControlPaint.LightLight (button.BackColor)), rectangle.Right, rectangle.Bottom, rectangle.Right, rectangle.Y);
+					}
+				}
+			} else {
+				// rendering checkbox or radio button style buttons
+				CheckBox checkbox = button as CheckBox;
+				RadioButton radiobutton = button as RadioButton;
+				bool draw_popup_checked = false;
+				
+				if (button.FlatStyle == FlatStyle.Popup) {
+					rect_fore_color = this.ColorButtonText;
+				
+					// see if we should draw a disabled checked popup button
+					draw_popup_checked = ((checkbox != null && checkbox.Checked) ||
+						(radiobutton != null && radiobutton.Checked));
+				}
+				
+				graphics.FillRectangle (ResPool.GetSolidBrush (rect_back_color), rectangle);
+				graphics.DrawRectangle(ResPool.GetPen (rect_fore_color), rectangle);
+				
+				// finally draw the flatstyle checked effect if need
+				if (draw_popup_checked) {
+					graphics.DrawLine ( ResPool.GetPen (ControlPaint.LightLight (button.BackColor)), rectangle.X, rectangle.Bottom, rectangle.Right, rectangle.Bottom);
+					graphics.DrawLine ( ResPool.GetPen (ControlPaint.LightLight (button.BackColor)), rectangle.Right, rectangle.Bottom, rectangle.Right, rectangle.Y);
 				}
 			}
 		}
@@ -629,27 +741,42 @@
 			dc.FillRectangle(sb, checkbox.ClientRectangle);
 			sb.Dispose();
 
-			// establish if we are rendering a flat style of some sort
-			if (checkbox.FlatStyle == FlatStyle.Flat || checkbox.FlatStyle == FlatStyle.Popup) {
-				DrawFlatStyleCheckBox (dc, checkbox_rectangle, checkbox);
+			// render as per normal button
+			if (checkbox.appearance==Appearance.Button) {
+				if (checkbox.FlatStyle == FlatStyle.Flat || checkbox.FlatStyle == FlatStyle.Popup) {
+					DrawFlatStyleButton(dc, text_rectangle, checkbox);
+				} else {
+					CPDrawButton(dc, text_rectangle, state);
+				}
 			} else {
-				// render as per normal
-				if (checkbox.appearance!=Appearance.Button) {
-					ControlPaint.DrawCheckBox(dc, checkbox_rectangle, state);
+				// establish if we are rendering a flat style of some sort
+				if (checkbox.FlatStyle == FlatStyle.Flat || checkbox.FlatStyle == FlatStyle.Popup) {
+					DrawFlatStyleCheckBox (dc, checkbox_rectangle, checkbox);
 				} else {
-					ControlPaint.DrawButton(dc, text_rectangle, state);
+					ControlPaint.DrawCheckBox(dc, checkbox_rectangle, state);
 				}
 			}
 			
 			// win32 compat - win32 seems to give the text a slight (3px) offset when rendering
 			Rectangle inner_text_rectangle = new Rectangle (text_rectangle.X + 3, text_rectangle.Y, Math.Max (text_rectangle.Width - 3, 0), text_rectangle.Height); 
-
+			// offset the text if it's pressed and a button
+			if (checkbox.Appearance == Appearance.Button) {
+				int buttonXOffset = 2;
+				int buttonYOffset = 0;
+				int pressedOffset = 0;
+				
+				if (checkbox.Checked || (checkbox.Capture && checkbox.FlatStyle != FlatStyle.Flat)) {
+					pressedOffset += 2;
+				}
+				
+				inner_text_rectangle = new Rectangle (inner_text_rectangle.X + buttonXOffset + pressedOffset, inner_text_rectangle.Y + buttonYOffset + pressedOffset, inner_text_rectangle.Width - 2*buttonXOffset, inner_text_rectangle.Height - 2*buttonYOffset); 
+			} 
 			/* Place the text; to be compatible with Windows place it after the checkbox has been drawn */
 			if (checkbox.Enabled) {
 				sb = ResPool.GetSolidBrush(checkbox.ForeColor);
 				dc.DrawString(checkbox.Text, checkbox.Font, sb, inner_text_rectangle, text_format);				
 			} else if (checkbox.FlatStyle == FlatStyle.Flat || checkbox.FlatStyle == FlatStyle.Popup) {
-				dc.DrawString(checkbox.Text, checkbox.Font, SystemBrushes.ControlDark, inner_text_rectangle, text_format);
+				dc.DrawString(checkbox.Text, checkbox.Font, ResPool.GetSolidBrush (ControlPaint.DarkDark (this.ColorButtonFace)), inner_text_rectangle, text_format);
 			} else {
 				CPDrawStringDisabled(dc, checkbox.Text, checkbox.Font, ColorButtonText, inner_text_rectangle, text_format);
 			}
@@ -1227,25 +1354,50 @@
 			dc.FillRectangle(sb, radio_button.ClientRectangle);
 			sb.Dispose();
 			
-			// establish if we are rendering a flat style of some sort
-			if (radio_button.FlatStyle == FlatStyle.Flat || radio_button.FlatStyle == FlatStyle.Popup) {
-				DrawFlatStyleRadioButton (dc, radiobutton_rectangle, radio_button);
-			} else {
-				// render as per normal
-				if (radio_button.appearance!=Appearance.Button) {
-					ControlPaint.DrawRadioButton (dc, radiobutton_rectangle, state);
+		
+			
+			if (radio_button.appearance==Appearance.Button) {
+				if (radio_button.FlatStyle == FlatStyle.Flat || radio_button.FlatStyle == FlatStyle.Popup) {
+					DrawFlatStyleButton(dc, text_rectangle, radio_button);
+				} else {				
+					CPDrawButton(dc, text_rectangle, state);
+				}		
+			} else {
+				// establish if we are rendering a flat style of some sort
+				if (radio_button.FlatStyle == FlatStyle.Flat || radio_button.FlatStyle == FlatStyle.Popup) {
+					DrawFlatStyleRadioButton (dc, radiobutton_rectangle, radio_button);
 				} else {
-					ControlPaint.DrawButton (dc, text_rectangle, state);
+					ControlPaint.DrawRadioButton (dc, radiobutton_rectangle, state);
 				}
 			}
 			
 			// wind32 compat - win32 seems to give the text a slight (3px) offset when rendering
-			Rectangle inner_text_rectangle = new Rectangle (text_rectangle.X + 3, text_rectangle.Y, Math.Max (text_rectangle.Width - 3, 0), text_rectangle.Height); 
+			Rectangle inner_text_rectangle = new Rectangle (text_rectangle.X + 3, text_rectangle.Y, Math.Max (text_rectangle.Width - 3, 0), text_rectangle.Height);
+			// offset the text if it's pressed and a button
+			if (radio_button.Appearance == Appearance.Button) {
+				int buttonXOffset = 2;
+				int buttonYOffset = 0;
+				int pressedOffset = 0;
+				
+				if (radio_button.Checked || (radio_button.Capture && radio_button.FlatStyle != FlatStyle.Flat)) {
+					pressedOffset += 2;
+				}
+				
+				inner_text_rectangle = new Rectangle (inner_text_rectangle.X + buttonXOffset + pressedOffset, inner_text_rectangle.Y + buttonYOffset + pressedOffset, inner_text_rectangle.Width - 2*buttonXOffset, inner_text_rectangle.Height - 2*buttonYOffset); 
+			} 
 
 			/* Place the text; to be compatible with Windows place it after the radiobutton has been drawn */
 			sb=new SolidBrush(radio_button.ForeColor);
 			dc.DrawString (radio_button.Text, radio_button.Font, sb, inner_text_rectangle, text_format);
 			sb.Dispose();
+			if (radio_button.Enabled) {
+				sb = ResPool.GetSolidBrush(radio_button.ForeColor);
+				dc.DrawString(radio_button.Text, radio_button.Font, sb, inner_text_rectangle, text_format);				
+			} else if (radio_button.FlatStyle == FlatStyle.Flat) {
+				dc.DrawString(radio_button.Text, radio_button.Font, ResPool.GetSolidBrush (ControlPaint.DarkDark (this.ColorButtonFace)), inner_text_rectangle, text_format);
+			} else {
+				CPDrawStringDisabled(dc, radio_button.Text, radio_button.Font, this.ColorButtonText, inner_text_rectangle, text_format);
+			}
 
 			if (radio_button.Focused) {
 				ControlPaint.DrawFocusRectangle(dc, text_rectangle);
@@ -1257,24 +1409,40 @@
 		{
 			int	lineWidth;
 			
-			// win32 compat fill in the background of the knob
-			graphics.FillPie (ResPool.GetSolidBrush (this.ColorWindow), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
-			
-			// draw the outer flatstyle arcs
-			if (radio_button.FlatStyle == FlatStyle.Flat) {
-				graphics.DrawArc (ResPool.GetPen (ColorButtonText), rectangle, 0, 359);
-			} else {
-				// must be a popup radio button
-				if (radio_button.is_entered) {
-					// draw the popup 3d button knob
-					graphics.DrawArc (SystemPens.ControlLight, rectangle.X+1, rectangle.Y+1, rectangle.Width-2, rectangle.Height-2, 0, 359);
-
-					graphics.DrawArc (SystemPens.ControlDark, rectangle, 135, 180);
-					graphics.DrawArc (SystemPens.ControlLightLight, rectangle, 315, 180);
+			if (radio_button.Enabled) {
+				// draw the outer flatstyle arcs
+				if (radio_button.FlatStyle == FlatStyle.Flat) {
+					graphics.DrawArc (ResPool.GetPen (radio_button.ForeColor), rectangle, 0, 359);
+					
+					// fill in the area depending on whether or not the mouse is hovering
+					if (radio_button.is_entered && radio_button.Capture) {
+						graphics.FillPie (ResPool.GetSolidBrush (ControlPaint.Light (radio_button.BackColor)), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
+					} else {
+						graphics.FillPie (ResPool.GetSolidBrush (ControlPaint.LightLight (radio_button.BackColor)), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
+					}
 				} else {
-					// just draw lighter flatstyle outer circle
-					graphics.DrawArc (SystemPens.ControlDark, rectangle, 0, 359);
+					// must be a popup radio button
+					// fill the control
+					graphics.FillPie (ResPool.GetSolidBrush (ControlPaint.LightLight (radio_button.BackColor)), rectangle, 0, 359);
+
+					if (radio_button.is_entered || radio_button.Capture) {
+						// draw the popup 3d button knob
+						graphics.DrawArc (ResPool.GetPen (ControlPaint.Light (radio_button.BackColor)), rectangle.X+1, rectangle.Y+1, rectangle.Width-2, rectangle.Height-2, 0, 359);
+
+						graphics.DrawArc (ResPool.GetPen (ControlPaint.Dark (radio_button.BackColor)), rectangle, 135, 180);
+						graphics.DrawArc (ResPool.GetPen (ControlPaint.LightLight (radio_button.BackColor)), rectangle, 315, 180);
+						
+					} else {
+						// just draw lighter flatstyle outer circle
+						graphics.DrawArc (ResPool.GetPen (ControlPaint.Dark (this.ColorButtonFace)), rectangle, 0, 359);						
+					}										
 				}
+			} else {
+				// disabled
+				// fill control background color regardless of actual backcolor
+				graphics.FillPie (ResPool.GetSolidBrush (this.ColorButtonFace), rectangle.X + 1, rectangle.Y + 1, rectangle.Width - 2, rectangle.Height - 2, 0, 359);
+				// draw the ark as control dark
+				graphics.DrawArc (ResPool.GetPen (ControlPaint.Dark(this.ColorButtonFace)), rectangle, 0, 359);
 			}
 
 			// draw the check
@@ -1283,12 +1451,14 @@
 				SolidBrush buttonBrush;
 
 				if (!radio_button.Enabled) {
-					buttonBrush = (SolidBrush) SystemBrushes.ControlDark;
+					buttonBrush = ResPool.GetSolidBrush (ControlPaint.Dark (this.ColorButtonFace));
+				} else if (radio_button.FlatStyle == FlatStyle.Popup && radio_button.is_entered && radio_button.Capture) {
+					buttonBrush = ResPool.GetSolidBrush (this.ColorButtonText);
 				} else {
-					buttonBrush = (SolidBrush) SystemBrushes.ControlText;
+					buttonBrush = ResPool.GetSolidBrush (radio_button.ForeColor);
 				}
 				graphics.FillPie (buttonBrush, rectangle.X+lineWidth, rectangle.Y+lineWidth, rectangle.Width-lineWidth*2, rectangle.Height-lineWidth*2, 0, 359);
-			}			
+			}	
 		}
 
 		public override Size RadioButtonDefaultSize {
@@ -2396,21 +2566,21 @@
 
 				if (doInner) {
 					if ((sides & Border3DSide.Left)!=0) {
-						graphics.DrawLine(penTopLeftInner, rect.Left+1, rect.Top+1, rect.Right-1, rect.Top+1);
+						graphics.DrawLine(penTopLeftInner, rect.Left+1, rect.Top+1, rect.Right-2, rect.Top+1);
 					} else {
-						graphics.DrawLine(penTopLeftInner, rect.Left, rect.Top+1, rect.Right-1, rect.Top+1);
+						graphics.DrawLine(penTopLeftInner, rect.Left, rect.Top+1, rect.Right-2, rect.Top+1);
 					}
 				}
 			}
 
 			if ((sides & Border3DSide.Right)!=0) {
-				graphics.DrawLine(penBottomRight, rect.Right-1, rect.Top, rect.Right-1, rect.Bottom-1);
+				graphics.DrawLine(penBottomRight, rect.Right, rect.Top, rect.Right, rect.Bottom);
 
 				if (doInner) {
 					if ((sides & Border3DSide.Top)!=0) {
-						graphics.DrawLine(penBottomRightInner, rect.Right-2, rect.Top+1, rect.Right-2, rect.Bottom-1);
+						graphics.DrawLine(penBottomRightInner, rect.Right-1, rect.Top+1, rect.Right-1, rect.Bottom-1);
 					} else {
-						graphics.DrawLine(penBottomRightInner, rect.Right-2, rect.Top, rect.Right-2, rect.Bottom-1);
+						graphics.DrawLine(penBottomRightInner, rect.Right-1, rect.Top, rect.Right-1, rect.Bottom-1);
 					}
 				}
 			}
@@ -2422,13 +2592,13 @@
 					left+=1;
 				}
 
-				graphics.DrawLine(penBottomRight, rect.Left, rect.Bottom-1, rect.Right-1, rect.Bottom-1);
+				graphics.DrawLine(penBottomRight, rect.Left, rect.Bottom, rect.Right, rect.Bottom);
 
 				if (doInner) {
 					if ((sides & Border3DSide.Right)!=0) {
-						graphics.DrawLine(penBottomRightInner, left, rect.Bottom-2, rect.Right-2, rect.Bottom-2);
+						graphics.DrawLine(penBottomRightInner, left, rect.Bottom-1, rect.Right-1, rect.Bottom-1);
 					} else {
-						graphics.DrawLine(penBottomRightInner, left, rect.Bottom-2, rect.Right-1, rect.Bottom-2);
+						graphics.DrawLine(penBottomRightInner, left, rect.Bottom-1, rect.Right, rect.Bottom-1);
 					}
 				}
 			}
@@ -2639,7 +2809,7 @@
 			Color			colorBackInverted;
 			Pen			pen;
 
-			//colorForeInverted=Color.FromArgb(Math.Abs(foreColor.R-255), Math.Abs(foreColor.G-255), Math.Abs(foreColor.B-255));
+ 			//colorForeInverted=Color.FromArgb(Math.Abs(foreColor.R-255), Math.Abs(foreColor.G-255), Math.Abs(foreColor.B-255));
 			//pen=new Pen(colorForeInverted, 1);
 			// MS seems to always use black
 			pen=new Pen(Color.Black, 1);
@@ -3307,16 +3477,19 @@
 		private void DrawFrameControl(Graphics graphics, Rectangle rectangle, DrawFrameControlTypes Type, DrawFrameControlStates State) {
 			switch(Type) {
 			case DrawFrameControlTypes.Button: {
-				if ((State & DrawFrameControlStates.ButtonPush)!=0) {
-					/* Goes first, affects the background */
-					if ((State & DrawFrameControlStates.Checked)!=0) {
-						HatchBrush	hatchBrush=new HatchBrush(HatchStyle.Percent50, ColorButtonLight, ColorButtonHilight);
-						graphics.FillRectangle(hatchBrush,rectangle);
-						hatchBrush.Dispose();
-					}
 
-					if ((State & DrawFrameControlStates.Pushed)!=0) {
-						CPDrawBorder3D(graphics, rectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
+				if ((State & DrawFrameControlStates.ButtonPush)!=0) {
+// JBA 31 oct 2004 - I don't think that button style should be rendered like this
+//					/* Goes first, affects the background */
+//					if ((State & DrawFrameControlStates.Checked)!=0) {
+//						HatchBrush	hatchBrush=new HatchBrush(HatchStyle.Percent50, ColorButtonLight, ColorButtonHilight);
+//						graphics.FillRectangle(hatchBrush,rectangle);
+//						hatchBrush.Dispose();
+//					}
+
+					if ((State & DrawFrameControlStates.Pushed)!=0 || (State & DrawFrameControlStates.Checked)!=0) {
+						//CPDrawBorder3D(graphics, rectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
+						graphics.DrawRectangle (ResPool.GetPen (ControlPaint.Dark (ColorButtonFace)), rectangle);
 					} else if ((State & DrawFrameControlStates.Flat)!=0) {
 						ControlPaint.DrawBorder(graphics, rectangle, ColorButtonShadow, ButtonBorderStyle.Solid);
 					} else if ((State & DrawFrameControlStates.Inactive)!=0) {

--=-7/gcI9ksrK1ro3wtyPaQ--