# vgui.Register

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

```lua
table vgui.Register( string classname, table panelTable, string baseName = "Panel" )
```

## Açıklama

[vgui.Create](https://gmod.tr/wiki/vgui.Create) aracılığıyla daha sonra oluşturulmak üzere bir panel kaydeder.

## Argümanlar

1. [string](https://gmod.tr/wiki/string) **classname**: Kaydedilecek panelin sınıf adıdır. Bu, [vgui.Create](https://gmod.tr/wiki/vgui.Create)'in ilk argümanına iletmeniz gereken şeydir. [baseclass.Set](https://gmod.tr/wiki/baseclass.Set)'in dahili kullanımı nedeniyle, varlıkların (entity) sınıf adları da dahil olmak üzere benzersiz olmalıdır.
2. [table](https://gmod.tr/wiki/table) **panelTable**: Panel bilgilerini içeren tablodur.
3. [string](https://gmod.tr/wiki/string) **baseName** = "Panel": İşlevselliği devralınacak bir panelin sınıf adıdır. Aynı isimlere sahip fonksiyonlar, kaydedilmekte olan panel tercih edilerek üzerine yazılacaktır.

## Dönen Değer

1. [table](https://gmod.tr/wiki/table): İkinci argümandan verilen panel tablosu

### Örnek

`DButton`'dan türetilen `PanelName` adında bir Panel tanımlar

```lua
local PANEL = {}
PANEL.ColorIdle = Color(255, 0, 0)
PANEL.ColorHovered = Color(0, 255, 0)

function PANEL:Paint(w, h)
	local color = self.ColorIdle

	if self:IsHovered() then
		color = self.ColorHovered
	end

	surface.SetDrawColor(color)
	surface.DrawRect(0, 0, w, h)
end

vgui.Register("PanelName", PANEL, "DButton")
```

### Örnek

Metotlarını eklemeden önce bir Panel tanımlar

```lua
local PANEL = vgui.Register("PanelName", {}, "Panel")

function PANEL:Paint(w, h)
	surface.SetDrawColor(255, 0, 0)
	surface.DrawRect(0, 0, w, h)
end
```

- [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/vgui.Register
