Is setting Bounds Property the same as setting Size and Location?

  • Thread starter Thread starter Academia
  • Start date Start date
A

Academia

Is there a difference between setting Control.Bounds Property (or using
Control.SetBoundsCore ) and setting the Location and the Size properties?

Is it simply that you can set them all at once rather that in two steps or
is there more to it than that?


Thanks
 
Is there a difference between setting Control.Bounds Property (or using
Control.SetBoundsCore ) and setting the Location and the Size properties?

Is it simply that you can set them all at once rather that in two steps or
is there more to it than that?

Thanks

The big difference I can see from the documentation, is that Bounds
sets the location relative to the non-client area. In other words, it
doesn't take into consideration the width of borders, etc, etc. So,
you would need to make sure that you were accounting for non-client
areas in the coordinates.
 
Tom Shelton said:
The big difference I can see from the documentation, is that Bounds
sets the location relative to the non-client area. In other words, it
doesn't take into consideration the width of borders, etc, etc. So,
you would need to make sure that you were accounting for non-client
areas in the coordinates.

Isn't that the same as what the Size property does?

Thanks
 
Academia said:
Isn't that the same as what the Size property does?


Bounds is equal to x,y, width, height. Size is equal to width, height.
Location is equal to x, y. Equal means identical, as the IL code says.


Armin
 
Isn't that the same as what the Size property does?

Thanks- Hide quoted text -

- Show quoted text -

I just did an experiement, and though the documentation seems to
indicate that setting Bounds does not take in to consideration the
client area of the form, that seems not to be true. It appears that
using bounds to set size and location is identicle to setting them
individually.
 
Tom Shelton said:
I just did an experiement, and though the documentation seems to
indicate that setting Bounds does not take in to consideration the
client area of the form, that seems not to be true. It appears that
using bounds to set size and location is identicle to setting them
individually.

I asked because I found the Bounds documentation confusing and was looking
for someone like yourself who has more insight into DotNet to comment.

Thanks
 
Back
Top