Garry's Mod Wiki

DFrame

Description

The DFrame is the moma of basically all VGUI elements. 98% of the time you will parent your element to this.

Parent

Derives from EditablePanel.

Example

Creates a basic DFrame.

local DFrame = vgui.Create( "DFrame" ) -- The name of the panel we don't have to parent it DFrame:SetPos(100, 100) -- Set the position to 100x by 100y DFrame:SetSize(300, 200) -- Set the size to 300x by 200y DFrame:SetTitle("Derma Frame") -- Set the title in the top left to 'Derma Frame' DFrame:MakePopup() -- Makes your mouse be able to move around

Example

Create an advanced customized DFrame.

surface.CreateFont("Font", {font = "Arial",extended = false,size = 20,}) -- Then font named 'Font' compacted on one line local faded_black = Color(0, 0, 0, 200) -- The color black but with 200 Alpha local DermaPanel = vgui.Create("DFrame") -- The name DermaPanel to store the value DFrame DermaPanel:SetSize(500, 300) -- Sets the size to 500x by 300y DermaPanel:Center() -- Centers the panel DermaPanel:SetTitle("") -- Set the title to nothing DermaPanel:SetDraggable(false) -- Makes it so you carnt drag it DermaPanel:MakePopup() -- Makes it so you can move your mouse on it DermaPanel.Paint = function(self, w, h) -- Paint function w, h = how wide and tall it is draw.RoundedBox(2, 0, 0, w, h, faded_black) -- Draws a rounded box with the color faded_black stored abouve draw.SimpleText("Derma Frame", "Font", 250, 0, color_white, TEXT_ALIGN_CENTER, TEXT_ALIGN_CENTER) -- Draws text in the color white end

Page Links


Special Pages


Wikis

?

Render Time: 25ms

DB GetPage 2
Generate Html 3
SaveChanges (1) 11
Render Body 0
Render Sidebar 7