Skinned/unskinned GUI controls size differences


What’s affect a control size when it has a skin applied?Because sizes of skinned and unskinned the same control are not equal
Lets assue a situation:

I have a button described by rect (x,y,w,h),and I’d like to draw a box around it distanced by l each side.Then the box’s rect shoud be defined like (x-l,y-l,w+2l,h+2l).

Well,above works as expected only if both button and box have no custom skin.When I apply my own,then suprisingly the button is larger than the box :open_mouth:

Surely this just means your skin has different settings for margin or padding for that control. That’s the purpose of skinning - to change the size and content of controls.

I presume this is due to padding/margin etc.

Notice that when you create a new GUIskin, each style, and specifically for your case - box and button styles have several definitions that change the way the viewable content of your object is painted by.

Look at the Padding, Border and Margin and notice they are different.

I suggest you have a look at what each of them does so you can play with it.

Check out guistyle:

Problem is solved-there was a border around inside graphics file.When I removed it all calculations give expected results.