예제 #1
0
파일: LRect.cs 프로젝트: yabos/SaveTheQueen
 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);
 }
예제 #2
0
파일: LRect.cs 프로젝트: yabos/SaveTheQueen
 public LRect(LPoint position, int width, int height)
 {
     left        = position.X;
     top         = position.Y;
     this.right  = left + width;
     this.bottom = top + height;
 }
예제 #3
0
파일: LRect.cs 프로젝트: yabos/SaveTheQueen
        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));
        }
예제 #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));
        }
예제 #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));
 }
예제 #6
0
파일: LRect.cs 프로젝트: yabos/SaveTheQueen
 public bool Has(LPoint point)
 {
     return((left <= point.X && top <= point.Y) && (left + Width > point.X && top + Height > point.Y));
 }
예제 #7
0
파일: LRect.cs 프로젝트: yabos/SaveTheQueen
        /// <summary>
        /// 상하좌우로 size만큼 작아진다
        /// </summary>


        public void Resize(LPoint size)
        {
            Width  += size.X;
            Height += size.Y;
        }
예제 #8
0
파일: LRect.cs 프로젝트: yabos/SaveTheQueen
 public void Offset(LPoint offset)
 {
     left += offset.X;
     top  += offset.Y;
 }