asmrobot
2019-11-25 2aeab450471cb80b59002da7da80faf251a0c4f4
src/RichCreator.Utility/Structs/ZTPoint.cs
@@ -9,21 +9,16 @@
    /// <summary>
    /// 点
    /// </summary>
    public class ZTPoint
    public struct ZTPoint:IEquatable<ZTPoint>
    {
        public static ZTPoint Empty = new ZTPoint(0,0);
        public ZTPoint()
        {
        }
        public ZTPoint(Int32 x, Int32 y)
        {
            this.X = x;
            this.Y = y;
        }
        public Int32 X { get; set; }
        public Int32 Y { get; set; }
@@ -63,6 +58,11 @@
            return new ZTPoint(this.X + val.X, this.Y + val.Y);
        }
        public ZTPoint Add(Int32 x, Int32 y)
        {
            return new ZTPoint(this.X + x, this.Y + y);
        }
        /// <summary>
        /// 两个坐标相减
        /// </summary>
@@ -73,19 +73,24 @@
            return new ZTPoint(this.X - val.X, this.Y - val.Y);
        }
        #region IEquatable
        public override int GetHashCode()
        {
            Int32 hashCode = 17;
            hashCode = hashCode * 23 + this.X;
            hashCode = hashCode * 23 + this.Y;
            return hashCode;
        }
        public bool Equals(ZTPoint other)
        {
            if (other == null)
            {
                return false;
            }
            if (this.X == other.X && this.Y == other.Y)
            {
                return true;
            }
            return false;
        }
        #endregion
    }
}