Garry's Mod Wiki


Panel:SetWrap( boolean wrap )


Sets whether text wrapping should be enabled or disabled on Label and DLabel panels. Use DLabel:SetAutoStretchVertical to automatically correct vertical size; Panel:SizeToContents will not set the correct height.


1 boolean wrap
True to enable text wrapping, false otherwise.


Creates two labels in a panel and sets the text wrapping to false and true respectively.

-- Background panel BGPanel = vgui.Create("DPanel") BGPanel:SetSize(300, 130) BGPanel:Center() BGPanel:SetBackgroundColor(Color(0, 0, 0)) -- Label with no text wrapping local lbl_nowrap = vgui.Create("DLabel", BGPanel) lbl_nowrap:SetPos(10, 10) lbl_nowrap:SetSize(280, 50) lbl_nowrap:SetFont("GModNotify") lbl_nowrap:SetText("This is a label that has text wrapping disabled.") lbl_nowrap:SetWrap(false) -- Label with text wrapping local lbl_wrap = vgui.Create("DLabel", BGPanel) lbl_wrap:SetPos(10, 70) lbl_wrap:SetSize(280, 50) lbl_wrap:SetFont("GModNotify") lbl_wrap:SetText("This is a label that has text wrapping enabled.") lbl_wrap:SetWrap(true)

Page Links

Special Pages



Render Time: 83ms

DB GetPage 48
Generate Html 7
SaveChanges (1) 14
Render Body 0
Render Sidebar 12