Garry's Mod Wiki

Panel:DockMargin

  Panel:DockMargin( number marginLeft, number marginTop, number marginRight, number marginBottom )

Description

Sets the dock margin of the panel.

The dock margin is the extra space that will be left around the edge when this element is docked inside its parent element.

Arguments

1 number marginLeft
The left margin to the parent.
2 number marginTop
The top margin to the parent.
3 number marginRight
The right margin to the parent.
4 number marginBottom
The bottom margin to the parent.

Example

Example showing the effects of DockMargin and DockPadding

local frame = vgui.Create("DFrame") frame:SetSize(600, 300) frame:SetTitle("Docking Demonstration") frame:Center() frame:MakePopup(true) local panel = vgui.Create("DPanel", frame) panel:DockMargin(10, 20, 30, 40) panel:DockPadding(40, 30, 20, 10) panel:Dock(FILL) local button = vgui.Create("DButton", panel) button:SetText("Lopsided proportions!") button:Dock(FILL)
Output: