# DImageButton

- **Ortam:** İstemci, Menü
- **İngilizce aslı:** https://wiki.facepunch.com/gmod/DImageButton
- **Çeviri tarihi:** 2025-09-08

## Açıklama

Bir resim düğmesi.

Bu panel, [DButton](https://gmod.tr/wiki/DButton)'ın [DLabel:DoClick](https://gmod.tr/wiki/DLabel:DoClick) gibi tüm metotlarını miras alır.

[Kaynağı görüntüle](https://github.com/Facepunch/garrysmod/blob/master/garrysmod/lua/vgui/dimagebutton.lua)

## Ebeveyn

Bu sayfada listelenmeyen metotları vb. [DButton](https://gmod.tr/wiki/DButton)'dan türetir.

## Metotlar

DImageButton:[DepressImage](https://gmod.tr/wiki/DImageButton:DepressImage)()

Bu dahili olarak kullanılır - kullanabilmenize rağmen muhtemelen kullanmamalısınız. Tıklandığında resmi kısaca ölçeklendirmek için dahili olarak kullanılır.

[boolean](https://gmod.tr/wiki/boolean) DImageButton:[GetDepressImage](https://gmod.tr/wiki/DImageButton:GetDepressImage)()

DImageButton:DepressImage'in işlevsel olup olmadığını döndürür.

[string](https://gmod.tr/wiki/string) DImageButton:[GetImage](https://gmod.tr/wiki/DImageButton:GetImage)()

DImageButton'ın "resmini" döndürür. DImage:GetImage'in eşdeğeridir.

[boolean](https://gmod.tr/wiki/boolean) DImageButton:[GetStretchToFit](https://gmod.tr/wiki/DImageButton:GetStretchToFit)()

Düğmenin içindeki resmin sığacak şekilde uzatılıp uzatılmayacağını döndürür Bkz. DImageButton:SetStretchToFit

DImageButton:[SetColor](https://gmod.tr/wiki/DImageButton:SetColor)( [table](https://gmod.tr/wiki/table) color )

Resmin rengini ayarlar. DImage:SetImageColor'ın eşdeğeridir

DImageButton:[SetDepressImage](https://gmod.tr/wiki/DImageButton:SetDepressImage)( [boolean](https://gmod.tr/wiki/boolean) enable )

DImageButton:DepressImage'in işlevsel olup olmadığını kontrol eder.

DImageButton:[SetIcon](https://gmod.tr/wiki/DImageButton:SetIcon)()

Bunu kullanmamanızı tavsiye ederiz. Gelecekteki bir güncellemede değiştirilebilir veya kaldırılabilir. DImageButton:SetImage'in takma adıdır.

DImageButton:[SetImage](https://gmod.tr/wiki/DImageButton:SetImage)( [string](https://gmod.tr/wiki/string) strImage, [string](https://gmod.tr/wiki/string) strBackup = nil )

DImageButton'ın "resmini" ayarlar. DImage:SetImage'in eşdeğeridir.

DImageButton:[SetImageVisible](https://gmod.tr/wiki/DImageButton:SetImageVisible)( [boolean](https://gmod.tr/wiki/boolean) visible )

Resim düğmesinin resmini gizler veya gösterir. Dahili olarak bu, dahili DImage üzerinde Panel:SetVisible'i çağırır.

DImageButton:[SetKeepAspect](https://gmod.tr/wiki/DImageButton:SetKeepAspect)( [boolean](https://gmod.tr/wiki/boolean) keep )

DImageButton'ın resminin en boy oranını koruyup korumayacağını ayarlar. DImage:SetKeepAspect'in eşdeğeridir. Bunun, resmi düğmenin içine sığdırmaya çalışmayacağını, bunun yerine düğmeyi resimle dolduracağını unutmayın.

DImageButton:[SetMaterial](https://gmod.tr/wiki/DImageButton:SetMaterial)( [IMaterial](https://gmod.tr/wiki/IMaterial) mat )

Bir Materyali doğrudan resim olarak ayarlar. DImage:SetMaterial'ın eşdeğeridir.

DImageButton:[SetOnViewMaterial](https://gmod.tr/wiki/DImageButton:SetOnViewMaterial)( [string](https://gmod.tr/wiki/string) mat, [string](https://gmod.tr/wiki/string) backup )

Bkz. DImage:SetOnViewMaterial

DImageButton:[SetStretchToFit](https://gmod.tr/wiki/DImageButton:SetStretchToFit)( [boolean](https://gmod.tr/wiki/boolean) stretch )

DImageButton'ın içindeki resmin, en boy oranını korumadan düğmenin tüm boyutunu dolduracak şekilde uzatılıp uzatılmayacağını ayarlar. Eğer false olarak ayarlanırsa, resim hiç yeniden boyutlandırılmaz.

### Örnek

DImageButton, DImage ile aynıdır, ancak ona tıklayabilirsiniz. Üzerine geldiğinizde, Windows'ta varsayılan bağlantı imlecini alırsınız.

```lua
local frame = vgui.Create( "DFrame" )
frame:SetSize( 300, 250 )
frame:Center()
frame:MakePopup()

local DermaImageButton = vgui.Create( "DImageButton", frame )
DermaImageButton:SetPos( 25, 50 )				-- Pozisyonu ayarla
-- DermaImageButton:SetSize( 16, 16 )			-- İSTEĞE BAĞLI: Boyutu biliyorsanız/sabitlemek istiyorsanız SizeToContents() yerine kullanın
DermaImageButton:SetImage( "icon16/bomb.png" )	-- Materyali ayarla - /materials/ dizinine göre
DermaImageButton:SizeToContents()				-- İSTEĞE BAĞLI: Otomatik olarak yeniden boyutlandırmak istiyorsanız (esnetmeden) SetSize yerine kullanın
DermaImageButton.DoClick = function()
	MsgN( "Resme tıkladınız!" )
end
```

**Çıktı:** ![](https://gmod.tr/api/uploads/wiki/8c2d91ff3af22b009491.png)

- [GMod Wiki ana sayfası](https://gmod.tr/wiki)

---

[Tüm sunucular](https://gmod.tr/) · [GmodTR Launcher](https://gmod.tr/launcher) · [Rehber](https://gmod.tr/rehber) · [GMod Wiki](https://gmod.tr/wiki) · [GmodTR nedir?](https://gmod.tr/hakkinda) · [Sunucu ekle](https://gmod.tr/sunucu-ekle) · [Discord](https://discord.gg/gmodtr)

Kaynak: https://gmod.tr/wiki/DImageButton
