Dave's Brain

Browse - Programming Tips - I keep to do something with all sides of a rectangle.

Date: 2011oct13
Platform: all

Q.  I keep to do something with all sides of a rectangle.
What's a sensible order to do it in?

A.  CSS does it in clockwise order from the top.
eg:

padding: 1px 2px 3px 4px
Will give you 1 pixel of padding on top, 2 on the right, 3 on the bottom and 4 on the left. So if you want to zero all of an Android Rect do this:
myrect.top = myrect.right = myrect.bottom = myrect.left = 0;
This isn't any law but I think its a nice practice.

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.