[Mono-winforms-list] Patch - Control.ForeColor property setter doesn't raise OnForeColorChanged

John BouAntoun jba-mono@optusnet.com.au
Mon, 11 Oct 2004 13:15:14 +1000


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

Hi guys,

This small patch makes sure that Control.ForeColor setter raises the
OnForeColorChanged() when the color is changed.

This makes sure that the controls load displaying the right forecolor
properly the first time a form loads  regardless of if the forecolor is
the default forecolor.

JBA

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

Index: System.Windows.Forms/Control.cs
===================================================================
RCS file: /cvs/public/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs,v
retrieving revision 1.68
diff -u -r1.68 Control.cs
--- System.Windows.Forms/Control.cs	6 Oct 2004 09:59:05 -0000	1.68
+++ System.Windows.Forms/Control.cs	11 Oct 2004 01:54:49 -0000
@@ -1354,8 +1354,11 @@
 			}
 
 			set {
-				foreground_color=value;
-				Refresh();
+				if (value != foreground_color) {
+					foreground_color=value;
+					Refresh();
+					OnForeColorChanged (EventArgs.Empty);
+				}
 			}
 		}
 

--=-21oJevCnafcDD5MROpeZ--