Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
 public LRect(LPoint position, int width, int height)
 {
     left        = position.X;
     top         = position.Y;
     this.right  = left + width;
     this.bottom = top + height;
 }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 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));
 }
Ejemplo n.º 6
0
 public bool Has(LPoint point)
 {
     return((left <= point.X && top <= point.Y) && (left + Width > point.X && top + Height > point.Y));
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 상하좌우로 size만큼 작아진다
        /// </summary>


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