DImageButton.SizeToContents

From GMod Wiki

Jump to: navigation, search
Function
Syntax DImageButton:SizeToContents( )
Description:
Changes the size to the same size as the image.
Returns: nil
In Object: DImageButton
Realm: NewerClient.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=DImageButton.SizeToContents]DImageButton.SizeToContents [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Examples

DescriptionCreates a button with Dr Mossmans face on it.
Used onNewerClient.png
Code
// myParent = a Panel based object.
myButton = vgui.Create("DImageButton", myParent)
myButton:SetMaterial( "VGUI/entities/npc_mossman" )
myButton:SizeToContents()
myButton.DoClick = function()
        Msg("You clicked the button!\n")
    end
myButton.DoRightClick = function()
        Msg("You right-clicked the button!\n")
    end
 
OutputN/A


See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox