custom textured inventory menu

Is there a way to put custom textures on any type of menu, ect. an inventory menu?

surface.DrawTexturedRect, surface.SetMaterial, and the basics of Derma/VGUI and using paint hooks.

Can you give me an example?



local mat = Material("icon16/box.png") --example image

testframe = vgui.Create("DFrame")
testframe:SetSize(200,100)
testframe:Center()
testframe:SetTitle("")
testframe:MakePopup()

local inv = vgui.Create("DGrid",testframe)
inv:Dock(FILL)
inv:SetCols(5)
inv:SetColWide(32)

for i = 1,10 do
local invitem = vgui.Create("DPanel")
invitem:SetSize(32,32)

function invitem:Paint(w,h)
    if i = 1 then
        surface.SetDrawColor(color_white)
        surface.SetMaterial(mat)
        surface.DrawTexturedRect(0,0,w,h)
    end
end

end


thanks :slight_smile: