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