Revision Difference
DImage#513674
<panel>⤶
<parent>DPanel</parent>⤶
<preview>DImage_preview.jpg</preview>⤶
<description>⤶
<page>DImage</page> is an advanced, more robust version of the <page>Material</page> panel.⤶
⤶
See <page>DImageButton</page> for a click-able version of this panel.⤶
</description>⤶
⤶
</panel>⤶
⤶
⤶
<example>⤶
<description>Creates a DImage of Dr. Breen inside a <page>DFrame</page> panel.</description>⤶
<code>⤶
-- 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")⤶
</code>⤶
⤶
</example>⤶
⤶
⤶
<example>⤶
<description>Creates three DImage panels and arranges them into a new image.</description>⤶
<code>⤶
-- 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")⤶
</code>⤶
<output></output>⤶
⤶
</example>⤶
⤶