public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } if ((destinationType == typeof(string)) && (value is SizeD)) { SizeD ef = (SizeD)value; if (culture == null) { culture = CultureInfo.CurrentCulture; } string separator = culture.TextInfo.ListSeparator + " "; TypeConverter converter = TypeDescriptor.GetConverter(typeof(double)); string[] strArray = new string[2]; int num = 0; strArray[num++] = converter.ConvertToString(context, culture, ef.Width); strArray[num++] = converter.ConvertToString(context, culture, ef.Height); return(string.Join(separator, strArray)); } if ((destinationType == typeof(System.ComponentModel.Design.Serialization.InstanceDescriptor)) && (value is SizeD)) { SizeD ef2 = (SizeD)value; System.Reflection.ConstructorInfo constructor = typeof(SizeD).GetConstructor(new Type[] { typeof(double), typeof(double) }); if (constructor != null) { return(new System.ComponentModel.Design.Serialization.InstanceDescriptor(constructor, new object[] { ef2.Width, ef2.Height })); } } return(base.ConvertTo(context, culture, value, destinationType)); }
/// <summary>Initializes a new instance of the <see cref="T:System.Drawing.RectangleD"></see> class with the specified location and size.</summary> /// <param name="size">A <see cref="T:System.Drawing.SizeD"></see> that represents the width and height of the rectangular region. </param> /// <param name="location">A <see cref="T:System.Drawing.PointD"></see> that represents the upper-left corner of the rectangular region. </param> public RectangleD(PointD location, SizeD size) { this.x = location.X; this.y = location.Y; this.width = size.Width; this.height = size.Height; }
/// <summary>Tests to see whether the specified object is a <see cref="T:EGIS.ShapeFileLib.SizeD"></see> with the same dimensions as this <see cref="T:EGIS.ShapeFileLib.SizeD"></see>.</summary> /// <returns>This method returns true if obj is a <see cref="T:EGIS.ShapeFileLib.SizeD"></see> and has the same width and height as this <see cref="T:EGIS.ShapeFileLib.SizeD"></see>; otherwise, false.</returns> /// <param name="obj">The <see cref="T:System.Object"></see> to test. </param> /// <filterpriority>1</filterpriority> public override bool Equals(object obj) { if (!(obj is SizeD)) { return(false); } SizeD ef = (SizeD)obj; return(((ef.Width == this.Width) && (ef.Height == this.Height)) && ef.GetType().Equals(base.GetType())); }
/// <summary>Translates a <see cref="T:EGIS.ShapeFileLib.PointD"></see> by the negative of a specified size.</summary> /// <returns>The translated <see cref="T:EGIS.ShapeFileLib.PointD"></see>.</returns> /// <param name="sz">The <see cref="T:EGIS.ShapeFileLib.SizeD"></see> that specifies the numbers to subtract from the coordinates of pt.</param> /// <param name="pt">The <see cref="T:EGIS.ShapeFileLib.PointD"></see> to translate.</param> public static PointD Subtract(PointD pt, SizeD sz) { return(new PointD(pt.X - sz.Width, pt.Y - sz.Height)); }
/// <summary>Translates a given <see cref="T:EGIS.ShapeFileLib.PointD"></see> by a specified <see cref="T:EGIS.ShapeFileLib.SizeD"></see>.</summary> /// <returns>The translated <see cref="T:EGIS.ShapeFileLib.PointD"></see>.</returns> /// <param name="sz">The <see cref="T:EGIS.ShapeFileLib.SizeD"></see> that specifies the numbers to add to the coordinates of pt.</param> /// <param name="pt">The <see cref="T:EGIS.ShapeFileLib.PointD"></see> to translate.</param> public static PointD Add(PointD pt, SizeD sz) { return(new PointD(pt.X + sz.Width, pt.Y + sz.Height)); }
/// <summary>Inflates this <see cref="T:System.Drawing.RectangleD"></see> by the specified amount.</summary> /// <returns>This method does not return a value.</returns> /// <param name="size">The amount to inflate this rectangle. </param> /// <filterpriority>1</filterpriority> public void Inflate(SizeD size) { this.Inflate(size.Width, size.Height); }
/// <summary>Initializes a new instance of the <see cref="T:EGIS.ShapeFileLib.SizeD"></see> class from the specified existing <see cref="T:EGIS.ShapeFileLib.SizeD"></see>.</summary> /// <param name="size">The <see cref="T:EGIS.ShapeFileLib.SizeD"></see> from which to create the new <see cref="T:EGIS.ShapeFileLib.SizeD"></see>. </param> public SizeD(SizeD size) { this.width = size.width; this.height = size.height; }
static SizeD() { Empty = new SizeD(); }
/// <summary>Subtracts the width and height of one <see cref="T:EGIS.ShapeFileLib.SizeD"></see> structure from the width and height of another <see cref="T:EGIS.ShapeFileLib.SizeD"></see> structure.</summary> /// <returns>The <see cref="T:EGIS.ShapeFileLib.SizeD"></see> that is a result of the subtraction operation.</returns> /// <param name="sz2">The <see cref="T:EGIS.ShapeFileLib.SizeD"></see> structure on the right side of the subtraction operator. </param> /// <param name="sz1">The <see cref="T:EGIS.ShapeFileLib.SizeD"></see> structure on the left side of the subtraction operator. </param> public static SizeD Subtract(SizeD sz1, SizeD sz2) { return(new SizeD(sz1.Width - sz2.Width, sz1.Height - sz2.Height)); }
/// <summary>Adds the width and height of one <see cref="T:EGIS.ShapeFileLib.SizeD"></see> structure to the width and height of another <see cref="T:EGIS.ShapeFileLib.SizeD"></see> structure.</summary> /// <returns>A <see cref="T:EGIS.ShapeFileLib.SizeD"></see> structure that is the result of the addition operation.</returns> /// <param name="sz2">The second <see cref="T:EGIS.ShapeFileLib.SizeD"></see> to add.</param> /// <param name="sz1">The first <see cref="T:EGIS.ShapeFileLib.SizeD"></see> to add.</param> public static SizeD Add(SizeD sz1, SizeD sz2) { return(new SizeD(sz1.Width + sz2.Width, sz1.Height + sz2.Height)); }
/// <summary>Subtracts the width and height of one <see cref="T:EGIS.ShapeFileLib.SizeD"></see> structure from the width and height of another <see cref="T:EGIS.ShapeFileLib.SizeD"></see> structure.</summary> /// <returns>The <see cref="T:EGIS.ShapeFileLib.SizeD"></see> that is a result of the subtraction operation.</returns> /// <param name="sz2">The <see cref="T:EGIS.ShapeFileLib.SizeD"></see> structure on the right side of the subtraction operator. </param> /// <param name="sz1">The <see cref="T:EGIS.ShapeFileLib.SizeD"></see> structure on the left side of the subtraction operator. </param> public static SizeD Subtract(SizeD sz1, SizeD sz2) { return new SizeD(sz1.Width - sz2.Width, sz1.Height - sz2.Height); }
/// <summary>Adds the width and height of one <see cref="T:EGIS.ShapeFileLib.SizeD"></see> structure to the width and height of another <see cref="T:EGIS.ShapeFileLib.SizeD"></see> structure.</summary> /// <returns>A <see cref="T:EGIS.ShapeFileLib.SizeD"></see> structure that is the result of the addition operation.</returns> /// <param name="sz2">The second <see cref="T:EGIS.ShapeFileLib.SizeD"></see> to add.</param> /// <param name="sz1">The first <see cref="T:EGIS.ShapeFileLib.SizeD"></see> to add.</param> public static SizeD Add(SizeD sz1, SizeD sz2) { return new SizeD(sz1.Width + sz2.Width, sz1.Height + sz2.Height); }