DImageButton
Methods
DImageButton:DepressImage()
This is used internally - although you're able to use it you probably shouldn't.
Used internally to briefly scale the image when clicked.
boolean DImageButton:GetDepressImage()
Returns whether DImageButton:DepressImage is functional or not.
Returns the "image" of the DImageButton. Equivalent of DImage:GetImage.
boolean DImageButton:GetStretchToFit()
Returns whether the image inside the button should be stretched to fit it or not
See DImageButton:SetStretchToFit
DImageButton:SetDepressImage( boolean enable )
Controls whether DImageButton:DepressImage is functional or not.
DImageButton:SetIcon()
We advise against using this. It may be changed or removed in a future update.
Alias of DImageButton:SetImage.
Sets the "image" of the DImageButton. Equivalent of DImage:SetImage.
DImageButton:SetImageVisible( boolean visible )
Hides or shows the image of the image button. Internally this calls Panel:SetVisible on the internal DImage.
DImageButton:SetKeepAspect( boolean keep )
Sets whether the DImageButton should keep the aspect ratio of its image. Equivalent of DImage:SetKeepAspect.
Note that this will not try to fit the image inside the button, but instead it will fill the button with the image.
DImageButton:SetMaterial( IMaterial mat )
Sets a Material directly as an image. Equivalent of DImage:SetMaterial.
See DImage:SetOnViewMaterial
DImageButton:SetStretchToFit( boolean stretch )
Sets whether the image inside the DImageButton should be stretched to fill the entire size of the button, without preserving aspect ratio.
If set to false, the image will not be resized at all.
Example
The DImageButton is the same as the DImage, but you can click it. When you hover over it, you will get the default link cursor on Windows.
Output: