[Mono-winforms-list] Patch for CPDrawComboButton

jba jba-mono@optusnet.com.au
Tue, 01 Feb 2005 00:14:00 +1100


--=-Jqzf+nm888LMzDUd7suM
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hey guys,

I know jordi is working on ComboBox at the moment, so I didn't know if I
could commit this change. It makes the combo button render properly when
pushed (like in windows).

In actuality the same kind of painting fixes that were applied to the
button classes need to be applied here.

So am I right to apply ?

Regards,

JBA.
P.S. patch was created in Maintenance.Windows.Forms folder

--=-Jqzf+nm888LMzDUd7suM
Content-Disposition: attachment; filename=CPComboButtonPushedFix.patch
Content-Type: text/x-patch; name=CPComboButtonPushedFix.patch; charset=UTF-8
Content-Transfer-Encoding: 7bit

Index: System.Windows.Forms/ThemeWin32Classic.cs
===================================================================
--- System.Windows.Forms/ThemeWin32Classic.cs	(revision 39835)
+++ System.Windows.Forms/ThemeWin32Classic.cs	(working copy)
@@ -3622,7 +3622,10 @@
 				ControlPaint.DrawBorder(graphics, rectangle, ColorButtonShadow, ButtonBorderStyle.Solid);
 			} else {
 				if ((state & (ButtonState.Pushed | ButtonState.Checked))!=0) {
-					CPDrawBorder3D(graphics, rectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
+					// this needs to render like a pushed button - jba
+					// CPDrawBorder3D(graphics, rectangle, Border3DStyle.Sunken, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
+					Rectangle trace_rectangle = new Rectangle(rectangle.X, rectangle.Y, Math.Max (rectangle.Width-1, 0), Math.Max (rectangle.Height-1, 0));
+					graphics.DrawRectangle (ResPool.GetPen (ControlPaint.Dark (ColorButtonFace)), trace_rectangle);
 				} else {
 					CPDrawBorder3D(graphics, rectangle, Border3DStyle.Raised, Border3DSide.Left | Border3DSide.Top | Border3DSide.Right | Border3DSide.Bottom, ColorButtonFace);
 				}

--=-Jqzf+nm888LMzDUd7suM--