vgui.Register
Example
Defines a Panel named PanelName
that derives from DButton
local PANEL = {}
PANEL.ColorIdle = Color(255, 0, 0)
PANEL.ColorHovered = Color(0, 255, 0)
function PANEL:Paint(w, h)
local color = self.ColorIdle
if self:IsHovered() then
color = self.ColorHovered
end
surface.SetDrawColor(color)
surface.DrawRect(0, 0, w, h)
end
vgui.Register("PanelName", PANEL, "DButton")