X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2FSystem.Drawing%2FSystem.Drawing%2FRectangleConverter.cs;h=b9c96e5a96e3c16c85a790475f58a5b81207fe38;hb=2007998771b1c4d9e762943676d7959daaf74385;hp=d7fffbe6e3d47030fdc07c50c7dd8f4cbdf145fa;hpb=21d1fdc48703514b1164ea2a76fc3bbf3d40871f;p=mono.git diff --git a/mcs/class/System.Drawing/System.Drawing/RectangleConverter.cs b/mcs/class/System.Drawing/System.Drawing/RectangleConverter.cs index d7fffbe6e3d..b9c96e5a96e 100644 --- a/mcs/class/System.Drawing/System.Drawing/RectangleConverter.cs +++ b/mcs/class/System.Drawing/System.Drawing/RectangleConverter.cs @@ -7,11 +7,7 @@ // Ravindra (rkumar@novell.com) // // Copyright (C) 2002 Ximian, Inc. http://www.ximian.com -// Copyright (C) 2004 Novell, Inc. http://www.novell.com -// - -// -// Copyright (C) 2004 Novell, Inc (http://www.novell.com) +// Copyright (C) 2004, 2006 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the @@ -33,7 +29,6 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -using System; using System.ComponentModel; using System.Collections; using System.Globalization; @@ -41,11 +36,8 @@ using System.Text; using System.ComponentModel.Design.Serialization; using System.Reflection; -namespace System.Drawing -{ - /// - /// Summary description for RectangleConverter. - /// +namespace System.Drawing { + public class RectangleConverter : TypeConverter { public RectangleConverter () @@ -133,11 +125,24 @@ namespace System.Drawing public override object CreateInstance (ITypeDescriptorContext context, IDictionary propertyValues) { +#if NET_2_0 + object ox = propertyValues ["X"]; + object oy = propertyValues ["Y"]; + object ow = propertyValues ["Width"]; + object oh = propertyValues ["Height"]; + if ((ox == null) || (oy == null) || (ow == null) || (oh == null)) + throw new ArgumentException ("propertyValues"); + + int x = (int) ox; + int y = (int) oy; + int width = (int) ow; + int height = (int) oh; +#else int x = (int) propertyValues ["X"]; int y = (int) propertyValues ["Y"]; int width = (int) propertyValues ["Width"]; int height = (int) propertyValues ["Height"]; - +#endif return new Rectangle (x, y, width, height); }