CRect::Width() and CRect::NormalizeRect()
-
Before asking Chris to add this one as a 'bug' in MSDN, maybe someone can shed a light on the following. In MSDN for CRect::Width() I read: Calculates the width of CRect by subtracting the left value from the right value. The width can be negative I read something analog for CRect::Height(): Calculates the height of CRect by subtracting the top value from the bottom value. The resulting value can be negative. And in a note for both: The rectangle must be normalized or this function may fail. You can call NormalizeRect to normalize the rectangle before calling this function. While I read for CRect::NormalizeRect(): Normalizes CRect so that both the height and width are positive. Then is my question: "How can the result of CRect::Width() or CRect::Height() be negative if you must normalize it first?
-
Before asking Chris to add this one as a 'bug' in MSDN, maybe someone can shed a light on the following. In MSDN for CRect::Width() I read: Calculates the width of CRect by subtracting the left value from the right value. The width can be negative I read something analog for CRect::Height(): Calculates the height of CRect by subtracting the top value from the bottom value. The resulting value can be negative. And in a note for both: The rectangle must be normalized or this function may fail. You can call NormalizeRect to normalize the rectangle before calling this function. While I read for CRect::NormalizeRect(): Normalizes CRect so that both the height and width are positive. Then is my question: "How can the result of CRect::Width() or CRect::Height() be negative if you must normalize it first?
Use the source, Luke ... :-D From afxwin1.inl (VC6):
_AFXWIN_INLINE int CRect::Width() const
{ return right - left; }
_AFXWIN_INLINE int CRect::Height() const
{ return bottom - top; }These function can't fail, unless MSDN means returning negative value by failure. Tomasz Sowinski -- http://www.shooltz.com
- It's for protection
- Protection from what? Zee Germans?