try this (C# syntax for the example)
Rectangle rect = new Rectangle( 1,1,3,3); // make a rectangle at 1,1 that is
3 wide and 3 high.
Debug.Assert (rect.Left == 1); // true
Debug.Assert (rect.Top == 1); // true
// right and bottom should be 3,3
Debug.Assert (rect.Right == 3); // FALSE
Debug.Assert (rect.Bottom == 3); // FALSE ?? huh
Debug.Assert (rect.Right == 4); // true - what gives?
Debug.Assert (rect.Bottom == 4); // true
Debug.Assert(rect.Contains(1,1)); // true
Debug.Assert(rect.Contains(3,3)); // true
Debug.Assert(rect.Contains(4,4)); // FALSE - hmmm
BUT if we adjust the contructor to give us the right and bottom we expect,
the rectangle will no longer Contain the correct pixels!
Rectangle rect = new Rectangle( 1,1,3-1,3-1); // make a rectangle at 1,1
that is 3 wide and 3 high.
Debug.Assert (rect.Right == 3); // true
Debug.Assert (rect.Bottom == 3); // true
BUT -
Debug.Assert(rect.Contains(3,3)); // FALSE
Mattias Sjögren - 21 Oct 2005 22:03 GMT
bryan,
First of all, this isn't really a CLR related question.
microsoft.public.dotnet.framework.drawing is a better group for
discussing GDI+ related matters.
Second, there's a good discussion about why the Win32 RECT is endpoint
exclusive here (it's relevant for the .NET Rectangle too).
http://blogs.msdn.com/oldnewthing/archive/2004/02/18/75652.aspx
Mattias

Signature
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.