Best way to add a image to a vgui

hey guys im making a vgui,

i got

[LUA] myImage = vgui.Create(“DImage”, Frame)
myImage:SetImage( “models/sickness/hummer-h2.mdl” )
myImage:setPos( 200, 200 )
myImage:SizeToContents()

[/LUA]

But it is showing up as purple is there anyway use a model?

thx brad

You can use the DModelPanel for displaying a model in a vgui frame.

Can i set its pos?
also can i stop it from spinning around?

You can either create your own texture where it isnt spinning, or use a spawnicon that doesn’t do anything when clicked.

If you do it with a spawn icon it will fail it will have like a box around it also can i do it with a screenshot? to create a texture

you can make a texture with any image

You can choose it’s own animation if you wanted. Here’s an example I did below:

[lua]
Model = vgui.Create( “DModelPanel” )
local PlayerModel = LocalPlayer():GetModel()

Model:SetSize( 520, 520 )
Model:Center()
Model:SetModel( PlayerModel )
Model:SetCamPos( Vector( 50, 0, 53 ) )
Model:SetLookAt( Vector( 0, 0, 50 ) )
Model:SetFOV( 118 )

function Model:LayoutEntity( Entity )
	
	local animseq = self.Entity:LookupSequence( "idle_subtle" )
	self.Entity:ResetSequence( animseq )
	
	self:RunAnimation()
	
end

[/lua]

That’s a model in the middle of your screen standing.