public Point CenterWithin(Rectangle container) { return new Point(((container.Width - Width) >> 1) + container.X, ((container.Height - Height) >> 1) + container.Y); }
/// <summary> /// Tests whether the System.Drawing.Rectangle structure has the same location and size of this System.Drawing.Rectangle structure. /// </summary> /// <param name="other"></param> /// <returns></returns> public bool Equals(Rectangle other) { return m_X == other.m_X && m_Y == other.m_Y && m_Width == other.m_Width && m_Height == other.m_Height; }