Example #1
0
        /// <summary>
        ///	Inflate Method
        /// </summary>
        ///
        /// <remarks>
        ///	Inflates the RectangleF_ by a specified Size.
        /// </remarks>

        public void Inflate(SizeF_ size)
        {
            x      -= size.Width;
            y      -= size.Height;
            width  += size.Width * 2;
            height += size.Height * 2;
        }
Example #2
0
        // -----------------------
        // Public Constructors
        // -----------------------

        /// <summary>
        ///	RectangleF Constructor
        /// </summary>
        ///
        /// <remarks>
        ///	Creates a RectangleF_ from PointF and SizeF values.
        /// </remarks>

        public RectangleF_(PointF_ location, SizeF_ size)
        {
            x      = location.X;
            y      = location.Y;
            width  = size.Width;
            height = size.Height;
        }
Example #3
0
        /// <summary>
        ///	Ceiling Shared Method
        /// </summary>
        ///
        /// <remarks>
        ///	Produces a Size structure from a SizeF structure by
        ///	taking the ceiling of the Width and Height properties.
        /// </remarks>

        public static Size_ Ceiling(SizeF_ value)
        {
            int w, h;

            checked {
                w = (int)Math.Ceiling(value.Width);
                h = (int)Math.Ceiling(value.Height);
            }

            return(new Size_(w, h));
        }
Example #4
0
        /// <summary>
        ///	Truncate Shared Method
        /// </summary>
        ///
        /// <remarks>
        ///	Produces a Size structure from a SizeF structure by
        ///	truncating the Width and Height properties.
        /// </remarks>

        public static Size_ Truncate(SizeF_ value)
        {
            int w, h;

            checked {
                w = (int)value.Width;
                h = (int)value.Height;
            }

            return(new Size_(w, h));
        }
Example #5
0
        public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
        {
            if (value is SizeF_)
            {
                SizeF_ size = (SizeF_)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(SizeF_).GetConstructor(new Type[] { typeof(float), typeof(float) });
                    return(new InstanceDescriptor(ctor, new object[] { size.Width, size.Height }));
                }
            }

            return(base.ConvertTo(context, culture, value, destinationType));
        }
Example #6
0
 public static PointF_ Subtract(PointF_ pt, SizeF_ sz)
 {
     return(new PointF_(pt.X - sz.Width, pt.Y - sz.Height));
 }
Example #7
0
 public static PointF_ Add(PointF_ pt, SizeF_ sz)
 {
     return(new PointF_(pt.X + sz.Width, pt.Y + sz.Height));
 }
Example #8
0
 public static SizeF_ Subtract(SizeF_ sz1, SizeF_ sz2)
 {
     return(new SizeF_(sz1.Width - sz2.Width,
                       sz1.Height - sz2.Height));
 }
Example #9
0
 public static SizeF_ Add(SizeF_ sz1, SizeF_ sz2)
 {
     return(new SizeF_(sz1.Width + sz2.Width,
                       sz1.Height + sz2.Height));
 }
Example #10
0
        /// <summary>
        ///	SizeF Constructor
        /// </summary>
        ///
        /// <remarks>
        ///	Creates a SizeF from an existing SizeF value.
        /// </remarks>

        public SizeF_(SizeF_ size)
        {
            width  = size.Width;
            height = size.Height;
        }