Beispiel #1
0
 public LRect(LPoint pointA, LPoint pointB)
 {
     left   = Math.Min(pointA.X, pointB.X);
     top    = Math.Min(pointA.Y, pointB.Y);
     right  = Math.Max(pointA.X, pointB.X);
     bottom = Math.Max(pointA.Y, pointB.Y);
 }
Beispiel #2
0
 public LRect(LPoint position, int width, int height)
 {
     left        = position.X;
     top         = position.Y;
     this.right  = left + width;
     this.bottom = top + height;
 }
Beispiel #3
0
        public static LRect Join(LRect lhs, LRect rhs)
        {
            LPoint start = new LPoint(Math.Min(lhs.left, rhs.left), Math.Min(lhs.top, rhs.top));
            LPoint end   = new LPoint(Math.Max(lhs.Right, rhs.Right), Math.Max(lhs.Bottom, rhs.Bottom));

            return(new LRect(start, end));
        }
Beispiel #4
0
        public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
        {
            if (destinationType == typeof(string) && value is LPoint)
            {
                LPoint p = (LPoint)value;

                return(p.X + "," + p.Y);
            }
            return(base.ConvertTo(context, culture, value, destinationType));
        }
Beispiel #5
0
 public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
 {
     if (value is string)
     {
         try
         {
             string s = (string)value;
             return(LPoint.Parse(s));
         }
         catch { }
         throw new ArgumentException("Can not convert '" + (string)value + "' to type Person");
     }
     return(base.ConvertFrom(context, culture, value));
 }
Beispiel #6
0
 public bool Has(LPoint point)
 {
     return((left <= point.X && top <= point.Y) && (left + Width > point.X && top + Height > point.Y));
 }
Beispiel #7
0
        /// <summary>
        /// 상하좌우로 size만큼 작아진다
        /// </summary>


        public void Resize(LPoint size)
        {
            Width  += size.X;
            Height += size.Y;
        }
Beispiel #8
0
 public void Offset(LPoint offset)
 {
     left += offset.X;
     top  += offset.Y;
 }