Material:SetMaterial
Description
Sets the material used by the panel.
If the material is not showing up as the correct size, try setting the Material panel's
AutoSize
variable to falseArguments
Example
Creates a Material panel and sets the material to a screen space effect.
-- Black background panel
BGPanel = vgui.Create("DPanel")
BGPanel:SetSize(200, 200)
BGPanel:Center()
BGPanel:SetBackgroundColor(Color(0, 0, 0, 255))
local mat = vgui.Create("Material", BGPanel)
mat:SetPos(5, 5)
mat:SetSize(190, 190)
-- It's not really good to use a models material for VGUI drawing
-- But it looks good enough for a quick demo
mat:SetMaterial("models/screenspace")
-- Stretch to fit
mat.AutoSize = false
Output: 
