예제 #1
0
            internal void BorderOrPaddingChanged()
            {
                SquareWidth border  = componentReference.border;
                SquareWidth padding = componentReference.padding;

                if (componentLocationSet)
                {
                    content.x = component.x + border.left + padding.left;
                    content.y = component.y + border.bottom + padding.bottom;
                }
                else if (contentLocationSet)
                {
                    component.x = content.x - padding.left - border.left;
                    component.y = content.y - padding.bottom - border.bottom;
                }

                if (componentSizeSet)
                {
                    content.width  = component.width - border.left - border.right - padding.left - padding.right;
                    content.height = component.height - border.bottom - border.top - padding.bottom - padding.top;
                }
                else if (contentLocationSet)
                {
                    component.width  = content.width + border.left + border.right + padding.left + padding.right;
                    component.height = content.height + border.bottom + border.top + padding.bottom + padding.top;
                }
            }
예제 #2
0
            internal void SetContentSize(Int32 width, Int32 height)
            {
                if (componentSizeSet)
                {
                    throw new InvalidOperationException("You cannot set the components 'ContentSize' after setting its 'ComponentSize', you can only set one or the other");
                }
                contentSizeSet = true;

                content.width  = width;
                content.height = height;

                SquareWidth border  = componentReference.border;
                SquareWidth padding = componentReference.padding;

                component.width  = content.width + border.left + border.right + padding.left + padding.right;
                component.height = content.height + border.bottom + border.top + padding.bottom + padding.top;
            }
예제 #3
0
            internal void SetContentLocation(Int32 x, Int32 y)
            {
                if (componentLocationSet)
                {
                    throw new InvalidOperationException("You cannot set the components 'ContentLocation' after setting its 'ComponentLocation', you can only set one or the other");
                }
                contentLocationSet = true;

                content.x = x;
                content.y = y;

                SquareWidth border  = componentReference.border;
                SquareWidth padding = componentReference.padding;

                component.x = content.x - padding.left - border.left;
                component.y = content.y - padding.bottom - border.bottom;
            }