# DGrid

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

## Açıklama

Gerçekten basit bir ızgara düzeni paneli.

> **NOT:** Bu panel, ayarlanan sütun sayısına göre boyutunu otomatik olarak belirleyecektir. Bu durum, [Panel:Dock](https://gmod.tr/wiki/Panel:Dock) ile kötü çalışmasına ve her karede bir [PANEL:PerformLayout](https://gmod.tr/wiki/PANEL:PerformLayout) çağrısı yapılmasına neden olur.

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

## Ebeveyn

Bu sayfada listelenmeyen metotları vb. [Panel](https://gmod.tr/wiki/Panel)'den miras alır.

## Metotlar

DGrid:[AddItem](https://gmod.tr/wiki/DGrid:AddItem)( [Panel](https://gmod.tr/wiki/Panel) item )

Izgaraya yeni bir öğe ekler.

[number](https://gmod.tr/wiki/number) DGrid:[GetCols](https://gmod.tr/wiki/DGrid:GetCols)()

Bu DGrid'in sütun sayısını döndürür. DGrid:SetCols ile ayarlanır.

[number](https://gmod.tr/wiki/number) DGrid:[GetColWide](https://gmod.tr/wiki/DGrid:GetColWide)()

DGrid'in her bir sütununun DGrid:SetColWide ile ayarlanan genişliğini döndürür.

[table](https://gmod.tr/wiki/table) DGrid:[GetItems](https://gmod.tr/wiki/DGrid:GetItems)()

Izgaradaki panellerin bir listesini döndürür.

[number](https://gmod.tr/wiki/number) DGrid:[GetRowHeight](https://gmod.tr/wiki/DGrid:GetRowHeight)()

DGrid'in her bir satırının DGrid:SetRowHeight ile ayarlanan yüksekliğini döndürür.

DGrid:[RemoveItem](https://gmod.tr/wiki/DGrid:RemoveItem)( [Panel](https://gmod.tr/wiki/Panel) item, [boolean](https://gmod.tr/wiki/boolean) bDontDelete = false )

Verilen paneli DGrid:GetItems'tan kaldırır.

DGrid:[SetCols](https://gmod.tr/wiki/DGrid:SetCols)( [number](https://gmod.tr/wiki/number) cols )

Bu panelin sahip olması gereken sütun sayısını ayarlar. DGrid, bu değere uyacak şekilde genişliğini yeniden boyutlandıracaktır.

DGrid:[SetColWide](https://gmod.tr/wiki/DGrid:SetColWide)( [number](https://gmod.tr/wiki/number) colWidth )

Her bir sütunun genişliğini ayarlar. Hücre panelleri (ızgara öğeleri) yeniden boyutlandırılmayacak veya ortalanmayacaktır.

DGrid:[SetRowHeight](https://gmod.tr/wiki/DGrid:SetRowHeight)( [number](https://gmod.tr/wiki/number) rowHeight )

Her bir satırın yüksekliğini ayarlar. Hücre panelleri (ızgara öğeleri) yeniden boyutlandırılmayacak veya ortalanmayacaktır.

DGrid:[SortByMember](https://gmod.tr/wiki/DGrid:SortByMember)( [string](https://gmod.tr/wiki/string) key, [boolean](https://gmod.tr/wiki/boolean) desc = true )

Izgaradaki öğeleri sıralar. Izgarayı görsel olarak güncellemez, bunun için Panel:InvalidateLayout kullanın.

### Örnek

Numaralandırılmış düğmelerle basit bir ızgara oluşturur.

```lua
local frame = vgui.Create( "DFrame" )
frame:SetPos( 500, 500 )
frame:SetSize( 200, 300 )
frame:SetTitle( "Frame" )
frame:MakePopup()

local grid = vgui.Create( "DGrid", frame )
grid:SetPos( 10, 30 )
grid:SetCols( 5 )
grid:SetColWide( 36 )

for i = 1, 30 do
	local but = vgui.Create( "DButton" )
	but:SetText( i )
	but:SetSize( 30, 20 )
	grid:AddItem( but )
end
```

![gmod_mDemqnU0BF.png](https://gmod.tr/api/uploads/wiki/683cd5c73bb37a6be947.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/DGrid
