Garry's Mod Wiki

DPanel

Description

A simple rectangular box, commonly used for parenting other elements to. Pretty much all elements are based on this.

Parent

Derives from Panel.

Methods

table DPanel:GetBackgroundColor()
Returns the panel's background color. By default this returns nil even though the default background color is white
boolean DPanel:GetDisabled()
Returns whether or not the panel is disabled.
boolean DPanel:GetDrawBackground()
We advise against using this. It may be changed or removed in a future update. You should use DPanel:GetPaintBackground instead. Returns whether or not the panel background is being drawn. Alias of DPanel:GetPaintBackground.
boolean DPanel:GetPaintBackground()
Returns whether or not the panel background is being drawn.
DPanel:SetBackgroundColor( table color )
Sets the background color of the panel.
DPanel:SetDisabled( boolean disabled )
Sets whether or not to disable the panel.
DPanel:SetDrawBackground( boolean draw )
We advise against using this. It may be changed or removed in a future update. You should use DPanel:SetPaintBackground instead. Sets whether or not to draw the panel background. Alias of DPanel:SetPaintBackground.
DPanel:SetPaintBackground( boolean paint )
Sets whether or not to paint/draw the panel background.

Example

Creates a DPanel and adds a DLabel to it

local DPanel = vgui.Create( "DPanel" ) DPanel:SetPos( 10, 30 ) -- Set the position of the panel DPanel:SetSize( 200, 200 ) -- Set the size of the panel local DLabel = vgui.Create( "DLabel", DPanel ) DLabel:SetPos( 10, 10 ) -- Set the position of the label DLabel:SetText( "I'm a DLabel inside a DPanel! :)" ) -- Set the text of the label DLabel:SizeToContents() -- Size the label to fit the text in it DLabel:SetDark( 1 ) -- Set the colour of the text inside the label to a darker one
Output:

Methods

Page Links


Special Pages


Wikis

?

Render Time: 102ms

DB GetPage 49
Generate Html 21
SaveChanges (1) 11
Render Body 0
Render Sidebar 18