示例#1
0
        // -----------------------
        // 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;
        }
示例#2
0
        /// <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;
        }
示例#3
0
        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));
        }
示例#4
0
 public Bitmap(Image original, Size_ newSize)  : this(original, newSize.Width, newSize.Height)
 {
 }
示例#5
0
        /// <summary>
        ///	Point Constructor
        /// </summary>
        ///
        /// <remarks>
        ///	Creates a Point from a Size value.
        /// </remarks>

        public Point_(Size_ sz)
        {
            x = sz.Width;
            y = sz.Height;
        }