# TextBox

Eine **TextBox** ist ein Eingabefeld für Text mit einer Zeile.

---

## Grundlagen

**Typ:** `[System.Windows.Forms.TextBoxBase]`

#### **TextBox erstellen**

```powershell
# Klassisch
$textBox = New-Object System.Windows.Forms.TextBox

# .NET-Style
$textBox = [TextBox]::new()
```


---

# **Properties** (Eigenschaften)

<details>
  <summary>Übersicht</summary>

  | Eigenschaft   | Standardwert  | Beschreibung
  | :-----------: | :-----------: | :-
  | `Anchor`      | `Top`, `Left` |
  | `BackColor`   | `Window`      | 
  | `BorderStyle` | `Fixed3D`     | 
  | `Dock`        | `None`        |
  | `Height`      | `23`
  | `ReadOnly`    | `False`       | 
  | `Text`        | `''`          |
    
</details>

### **Anchor**

### **BackColor**

### **BorderStyle**

**Typ:** [`[System.Windows.Forms.BorderStyle]`](https://doku.borinas.com/books/sprache/page/borderstyle)

| Wert          | Beschreibung
| :-----------: | -
| `None`        | 
| `FixedSingle` |
| `Fixed3D`     |

### **Dock**

**Typ:** [`[System.Windows.Forms.DockStyle]`](https://doku.borinas.com/books/sprache/page/dockstyle)

| Wert          | Beschreibung
| :-----------: | -
| `None`        | `TextBox` ist nicht angedockt
| `Top`         | Der obere Rand von `TextBox` ist am oberen Rand vom Parent-Container verankert.
| `Bottom`      | Der untere Rand von `TextBox` ist am unteren Rand vom Parent-Container verankert.
| `Left`        | Der linke Rand von `TextBox` ist am linken Rand vom Parent-Container verankert.
| `Right`       | Der rechte Rand von `TextBox` ist am rechten Rand vom Parent-Container verankert.
| `Fill`        | Alle Kanten von `TextBox` werden an allen Rändern von `TextBox` angedockt und entsprechend angepasst.

> **Hinweis**
>
> `Dock` füllt aus, weshalb bei den Werten `Top`, `Bottom` die Eigenschaft `Width` nicht greift. Genauso hat bei `Left` und `Right` die Eigenschaft `Height` keinen Effekt. Bei dem Wert `Fill` betrifft das beide.

### **Height**

### **ReadOnly**

**Typ:** `[System.Boolean]`

Deaktiviert das Bearbeiten vom Text in `TextBox`

### **Text**

**Typ:** `[System.String]`

Der angezeigte Text in der `TextBox`



---

# **Methods** (Methoden)

---

# **Events** (Ereignisse)

Der `TextBox` wird ein Event mit dem Präfix `Add_` und dem entsprechenden Namen vom **Event** hinzugefügt.
Als Argument wird bspw. ein [`ScriptBlock`](https://doku.borinas.com/books/sprache/page/skriptblock) erwartet.

```powershell
$textBox.Add_Click()
```

| Event       | Auslöser
| ----------- | -
| TextChanged | Wenn sich der Wert vom Text ändert.

### **TextChanged**

---

# Links

- [**Microsoft Learn** – TextBox Klasse](https://learn.microsoft.com/de-de/dotnet/api/system.windows.forms.textbox)