// ----------------------- // Public Constructors // ----------------------- /// <summary> /// Rectangle Constructor /// </summary> /// /// <remarks> /// Creates a Rectangle_ from Point and Size values. /// </remarks> public Rectangle_(Point_ location, Size_ size) { x = location.X; y = location.Y; width = size.Width; height = size.Height; }
/// <summary> /// Inflate Method /// </summary> /// /// <remarks> /// Inflates the Rectangle_ by a specified Size. /// </remarks> public void Inflate(Size_ size) { x -= size.Width; y -= size.Height; Width += size.Width * 2; Height += size.Height * 2; }
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (culture == null) { culture = CultureInfo.CurrentCulture; } // LAMESPEC: "The default implementation calls the ToString method // of the object if the object is valid and if the destination // type is string." MS does not behave as per the specs. // Oh well, we have to be compatible with MS. if (value is Size_) { Size_ size = (Size_)value; if (destinationType == typeof(string)) { return(size.Width.ToString(culture) + culture.TextInfo.ListSeparator + " " + size.Height.ToString(culture)); } else if (destinationType == typeof(InstanceDescriptor)) { ConstructorInfo ctor = typeof(Size_).GetConstructor(new Type[] { typeof(int), typeof(int) }); return(new InstanceDescriptor(ctor, new object[] { size.Width, size.Height })); } } return(base.ConvertTo(context, culture, value, destinationType)); }
public Bitmap(Image original, Size_ newSize) : this(original, newSize.Width, newSize.Height) { }
/// <summary> /// Point Constructor /// </summary> /// /// <remarks> /// Creates a Point from a Size value. /// </remarks> public Point_(Size_ sz) { x = sz.Width; y = sz.Height; }