Category:DImage

From Garry's Mod
Jump to: navigation, search

Contents

DescriptionPanelPage

DImage is an advanced, more robust version of the Material panel.

See DImageButton for a click-able version of this panel.

Inherited Functions

Inherits the following functions from DPanel and its parents up to 3 levels deep:


Examples

Example

Creates a DImage of Dr. Breen inside a DFrame panel.

-- Frame
Frame = vgui.Create("DFrame")
Frame:SetSize(200, 200)
Frame:Center()
Frame:SetTitle("Image of Dr. Breen")	-- Title of window

-- Image panel of Dr. Breen
local breen_img = vgui.Create("DImage", Frame)	-- Add image to Frame
breen_img:SetPos(10, 35)	-- Move it into frame
breen_img:SetSize(150, 150)	-- Size it to 150x150

-- Set material relative to "garrysmod/materials/"
breen_img:SetImage("scripted/breen_fakemonitor_1")


Examples

Example

Creates three DImage panels and arranges them into a new image.

-- Container panel
BGPanel = vgui.Create("DPanel")
BGPanel:SetSize(400, 400)
BGPanel:Center()
BGPanel:SetDrawBackground(false)

-- Wood background
local img_bg = vgui.Create("DImage", BGPanel)
img_bg:SetSize(BGPanel:GetSize())		
img_bg:SetImage("models/props_foliage/oak_tree01")

-- Blurred out screenshot of Construct
local img_construct = vgui.Create("DImage", BGPanel)
img_construct:SetPos(10, 10)
img_construct:SetSize(380, 380)		
img_construct:SetImage("hlmv/background")

-- Flatgrass sign
local img_text = vgui.Create("DImage", BGPanel)
img_text:SetPos(10, 20)
img_text:SetSize(380, 130)		
img_text:SetImage("gm_construct/flatsign")

Output:

DImage example2.jpg
Personal tools
Navigation