DImage:SetImage
Description
Sets the image to load into the frame. If the first image can't be loaded and strBackup
is set, that image will be loaded instead.
This eventually calls DImage:SetMaterial.
Arguments
Example
Creates a frame with a map of de_inferno inside, with the default avatar image loaded as a backup.
-- Frame
MainFrame = vgui.Create( "DFrame" )
MainFrame:SetSize( 300, 300 )
MainFrame:Center()
MainFrame:SetTitle( "Map of de_inferno" )
-- Map of de_inferno (requires CS:S)
local css_map = vgui.Create( "DImage", MainFrame )
css_map:SetPos( 25, 40 )
css_map:SetSize( 250, 250 )
-- Set image to de_inferno map
-- If it can't be loaded, load the [?] avatar image instead
css_map:SetImage("overviews/de_inferno", "vgui/avatar_default")
Output: If CS:S is mounted then the left image is shown, otherwise the right image is shown.