local Frame
= vgui.
Create(
"DFrame" )
Frame:
SetSize(
300,
400 )
Frame:
Center()
Frame:
MakePopup()
Frame:
SetSizable(
true )
local backgroundPanel
= vgui.
Create(
"DPanel", Frame )
backgroundPanel:
Dock( TOP )
backgroundPanel:
DockPadding(
4,
4,
4,
4 )
backgroundPanel:
DockMargin(
0,
0,
0,
4 )
local button1
= vgui.
Create(
"DButton", backgroundPanel )
button1:
Dock( TOP )
button1:
DockMargin(
0,
0,
0,
4 )
button1:
SetTall(
60 )
button1:
SetText(
"c1" )
local button2
= vgui.
Create(
"DButton", backgroundPanel )
button2:
Dock( TOP )
button2:
SetTall(
60 )
button2:
SetText(
"c2" )
backgroundPanel:
InvalidateLayout(
true )
backgroundPanel:
SizeToChildren(
false,
true )
local backgroundPanel
= vgui.
Create(
"DPanel", Frame )
backgroundPanel:
Dock( TOP )
backgroundPanel:
DockPadding(
4,
4,
4,
4 )
local button1
= vgui.
Create(
"DButton", backgroundPanel )
button1:
Dock( TOP )
button1:
DockMargin(
0,
0,
0,
4 )
button1:
SetTall(
60 )
button1:
SetText(
"c1" )
local button2
= vgui.
Create(
"DButton", backgroundPanel )
button2:
Dock( TOP )
button2:
SetTall(
60 )
button2:
SetText(
"c2" )
backgroundPanel:
SizeToChildren(
false,
true )
Output: