Panel.GetSize

From GMod Wiki

Jump to: navigation, search
Function
Syntax Panel:GetSize( )
Description:
Returns the size of this panel.
Returns: Number width, Number height
In Object: Panel
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Panel.GetSize]Panel.GetSize [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionMakes the panel show its width and height in the title bar.
Used onNewerClient.png
Code
 
local DermaPanel = vgui.Create( "DFrame" ) -- Creates the frame itself
DermaPanel:SetSize( ScrW( ) / 2, ScrH( ) / 2 ) -- Size of the frame ( use half the width / height of your screen )
DermaPanel:Center( ) -- Center the frame on the screen
local Size_X, Size_Y = DermaPanel:GetSize( ) -- Get the size of the panel
local Title = "Size: (" .. tostring( Size_X ) .. ", " .. tostring( Size_Y ) .. ")" -- Set our title in a variable
DermaPanel:SetTitle( Title ) -- Title of the frame
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true ) -- Draggable by mouse?
DermaPanel:ShowCloseButton( true ) -- Show the close button?
DermaPanel:MakePopup( ) -- Show the frame
 
OutputN/A


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox