# ShapeCollection.Add Method

> Adds an object of the type Shape to the collection.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 23.0
- **Namespace:** `TXTextControl.Drawing`
- **Package:** `TXTextControl.TextControl.WPF.SDK` (assembly `TXDrawing.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXDrawing.dll` from the setup
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl.Drawing > ShapeCollection.Add Method
- **807 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-drawing/shapecollection/add-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-drawing/shapecollection/add-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-drawing/shapecollection/add-method/llms-full.txt

---

### Description

Adds an object of the type [Shape](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-drawing/shape/llms-full.txt) to the [collection](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-drawing/shapecollection/llms-full.txt).

### Syntax

#### Add(Shape)

Adds an object of the type Shape to the collection. The shape is drawn at its defined [location](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-drawing/shape/location-property/llms-full.txt) with its defined [size](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-drawing/shape/size-property/llms-full.txt).

```csharp
public int Add(Shape shape);
```

```vbnet
Public Function Add(shape As Shape) As Integer
```

| Parameter | Description |
|---|---|
| shape | Specifies the [shape](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-drawing/shape/llms-full.txt). |

#### Add(Shape, ShapeCollection.AddStyle)

Adds an object of the type Shape to the collection. The addStyle parameter [determines](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-drawing/shapecollection-addstyle/enumeration/llms-full.txt) the location and size in which the shape is added.

```csharp
public int Add(Shape shape, ShapeCollection.AddStyle addStyle);
```

```vbnet
Public Function Add(shape As Shape, addStyle As ShapeCollection.AddStyle) As Integer
```

| Parameter | Description |
|---|---|
| shape | Specifies the [shape](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-drawing/shape/llms-full.txt). |
| addStyle | Specifies [style how to add](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-drawing/shapecollection-addstyle/enumeration/llms-full.txt) the shape to the collection. |

### Examples

The following example adds an item to the shape collection.

```csharp
var result = shapeCollection.Add(new TXTextControl.Drawing.Shape(), TXTextControl.Drawing.ShapeCollection.AddStyle.Fill);
Console.WriteLine($"Add result: {result}");
```

```vbnet
Dim result = shapeCollection.Add(New TXTextControl.Drawing.Shape(), TXTextControl.Drawing.ShapeCollection.AddStyle.Fill)
Console.WriteLine($"Add result: {result}")
```

---

## Nearby

- **Previous:** [ShapeCollection Class](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-drawing/shapecollection/llms-full.txt)
- **Next:** [ShapeCollection.AddStyle Enumeration](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-drawing/shapecollection-addstyle/enumeration/llms-full.txt)
