Get the size of an Area/Box/Object??

Is it possible through code to return the size of an area? I have GUILayout.BeginArea with a GUIStyle appended to it. It already positions itself in the middle of the screen regardless of the scaling or size of the screen but what I would like to do is find out the size of the image that is on that GUIStyle and dynamically populate that into GUILayout.BeginArea rather then have it hard coded in so I can swap backgrounds easy even if they are different size.

Any Ideas?

After you draw your area you can call GUILayoutUtility.GetLastRect().

It only seems to work properly during the Repaint event, though.

So in our code we draw our button and do this:

if( Event.current.type == EventType.Repaint )
{
    // this.Rect is a property on our script that we use to store off the size
    this.Rect = GUILayoutUtility.GetLastRect();
}