-1

This may be a simple question but I can't seem to find the answer after googling or going on the MSDN!

I have defined a rectangle using the following:

gridSecondRect3 = new Rectangle(324, 172, 471, 304);

I understand the first 2 number are the stating x & y, and the last 2 are the finishing x&y of the rectangle.

I understand how to access the first two using gridSecondRect3.X (or .Y)

However, I would like to know how to access the last 2 numbers.

I've tried using the .Height & .Width operators, however it didn't work.

Habib
  • 219,104
  • 29
  • 407
  • 436
Rich
  • 15
  • 1
  • 9
  • just out of curiosity, have you _ever_ got an acceptable answer to your questions? I noticed you asked 13 questions, and none have an answer marked... – davidsbro Jan 17 '14 at 17:26
  • 1
    You should be aware that the third and fourth arguments to the `Rectangle` constructor are *not* the coordinates for the rectangle's bottom right corner. They are, in fact, the width and height of the rectangle. – Cole Campbell Jan 17 '14 at 21:08

1 Answers1

2

Use Right and Bottom properties.

Rectangle.Right Property

Returns the x-coordinate of the right side of the rectangle.

Rectangle.Bottom Property

Returns the y-coordinate of the bottom of the rectangle.

Habib
  • 219,104
  • 29
  • 407
  • 436
  • That's what I thought. The reason I need this is because I'm programming for touch input on a windows phone, I'm using rectangles so i can check what part of my chess board the user has touched. When I input the numbers manually it works, however when I add the .bottom and .right it allows me to click outside of the rectangle so I didn't think it was correct – Rich Jan 17 '14 at 17:28