Garry's Mod Wiki

DShape

Description

Draw a shape on a derma panel. Only one kind of shape, a rectangle, is available for use.

View source

Parent

Derives methods, etc not listed on this page from DPanel.

Methods

Returns the current type of shape this panel is set to display. See DShape:SetBorderColor.
table DShape:GetColor()
Returns the color set to display the shape with.
string DShape:GetType()
Returns the current type of shape this panel is set to display. See DShape:SetType.
DShape:SetBorderColor( table clr )
Sets the border color of the shape. Currently does nothing.
DShape:SetColor( table clr )
Sets the color to display the shape with.
DShape:SetType( string type )
Sets the shape to be drawn.

Example

Creates the DShape rectangle within a small popup frame

local Frame = vgui.Create( "DFrame" ) -- Create a frame Frame:SetTitle( "Test panel" ) Frame:SetSize(400,400) Frame:Center() Frame:MakePopup() local Shape = vgui.Create( "DShape", Frame ) Shape:SetType( "Rect" ) -- This is the only type it can be Shape:SetPos( 100, 100 ) Shape:SetColor( Color(0, 255, 0, 255) ) Shape:SetSize( 200, 200 )
Output: