Adding a picture to the button

How do you add a picture/model to your button in the vgui

this is my current code for the button

local AButton = vgui.Create( "DButton", BackGround )
AButton:SetSize(150, 80 )
AButton:SetText( "Ak47" )
AButton:SetPos( 50, 20 )
AButton.DoClick = function ()
	ply:ConCommand("Give weapon_ak47")

Do i add a AButton:SetPic(File name) or is it something more complicated?


Stop making so many threads use to search
or post in one of your other threats for example this would have been fine in the last menu thread you posted

thats all fine and well and im sorry for spamming your forum. However no offence intended but your not really helping me much.

This is supposed to be the “newbie” section and your just giving me a link. I dont know where im supposed to put this code, or how im supposed to put it in.
And i dont see how drawing the word “hello” is ANYTHING to do with a background picture for my button



Sorry for getting annoyed, im going to go to sleep now, thanks for all the help :slight_smile:


Well you can use the draw library to draw over the button in a panel paint function with


and example of doing this is here


or you can use

DImageButton anyone?

Wasn’t this question already answered in the wiki?
The one about basic derma?

edit: Yes, i do believe it was mentioned in there.

Look at the example in the middle.

It’s not me who’s asking the question.