Garry's Mod Wiki

DScrollPanel:GetVBar

Description

Returns the vertical scroll bar of the panel.

Returns

Example

Example of styling a scrollbar

local DFrame = vgui.Create("DFrame") DFrame:SetSize(500, 500) DFrame:Center() DFrame:MakePopup() DFrame:SetTitle("Scrollbar Example") function DFrame:Paint(w, h) draw.RoundedBox(0, 0, 0, w, h, Color(0, 100, 100)) end local DScrollPanel = vgui.Create("DScrollPanel", DFrame) DScrollPanel:SetSize(400, 250) DScrollPanel:Center() local sbar = DScrollPanel:GetVBar() function sbar:Paint(w, h) draw.RoundedBox(0, 0, 0, w, h, Color(0, 0, 0, 100)) end function sbar.btnUp:Paint(w, h) draw.RoundedBox(0, 0, 0, w, h, Color(200, 100, 0)) end function sbar.btnDown:Paint(w, h) draw.RoundedBox(0, 0, 0, w, h, Color(200, 100, 0)) end function sbar.btnGrip:Paint(w, h) draw.RoundedBox(0, 0, 0, w, h, Color(100, 200, 0)) end local str = "" for i = 1, 50 do str = str .. "more space!\n" end local DLabel = vgui.Create("DLabel", DScrollPanel) DLabel:SetText(str) DLabel:Center() DLabel:SizeToContents()
Output: