// 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
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-using System;
using System.ComponentModel;
using System.Collections;
using System.Globalization;
using System.ComponentModel.Design.Serialization;
using System.Reflection;
-namespace System.Drawing
-{
- /// <summary>
- /// Summary description for RectangleConverter.
- /// </summary>
+namespace System.Drawing {
+
public class RectangleConverter : TypeConverter
{
public RectangleConverter ()
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);
}