# TXBarcodeControl.PrintPaint Method

> Draws the barcode on a specific object of type System.Drawing.Graphics or System.Windows.Media.DrawingContext with specified bounds or stretch factor.

- **Product:** TX Text Control .NET for WPF
- **Section:** Reference
- **Kind:** Method
- **Introduced:** 29.0
- **Namespace:** `TXTextControl.WPF.Barcode`
- **Package:** `TXTextControl.TextControl.WPF.SDK` (assembly `TXBarcode.WPF.dll`, from the private NuGet feed or Text Control Offline Packages)
- **.NET Framework:** reference `TXBarcode.WPF.dll` from the setup
- **Path:** TX Text Control .NET for WPF > Reference > TXTextControl.WPF.Barcode > TXBarcodeControl.PrintPaint Method
- **934 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf-barcode/txbarcodecontrol/printpaint-method/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf-barcode/txbarcodecontrol/printpaint-method/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf-barcode/txbarcodecontrol/printpaint-method/llms-full.txt

---

### Description

Draws the barcode on a specific object of type `System.Drawing.Graphics` or `System.Windows.Media.DrawingContext` with specified bounds or stretch factor.

### Syntax

#### PrintPaint(Graphics, Rectangle)

Draws the barcode on a specific object of type `System.Drawing.Graphics` with the specified bounds. The parameter position must be an object of type `System.Drawing.Rectangle`.

```csharp
public void PrintPaint(Graphics graphics, Rectangle position);
```

```vbnet
Public Sub PrintPaint(graphics As Graphics, position As Rectangle)
```

| Parameter | Description |
|---|---|
| graphics | Specifies the object of type `System.Drawing.Graphics` on which the barcode is drawn. |
| position | Specifies the position to draw on the specified object of type `System.Drawing.Graphics`. |

#### PrintPaint(DrawingContext, double)

Draws the barcode on a specific object of type `System.Windows.Media.DrawingContext` with the specified stretch factor.

```csharp
public void PrintPaint(DrawingContext drawingContext, double stretchFactor);
```

```vbnet
Public Sub PrintPaint(drawingContext As DrawingContext, stretchFactor As Double)
```

| Parameter | Description |
|---|---|
| drawingContext | Specifies the object of type `System.Windows.Media.DrawingContext` on which the barcode is drawn. |
| stretchFactor | Specifies the stretch factor to draw on the specified object of type `System.Windows.Media.DrawingContext`. |

#### PrintPaint(Rectangle)

```csharp
public string PrintPaint(Rectangle rectangle);
```

```vbnet
Public Function PrintPaint(rectangle As Rectangle) As String
```

### Examples

The following example uses Print Paint in a focused TXBarcode Control workflow.

```csharp
var result = tXBarcodeControl.PrintPaint(new System.Drawing.Rectangle(20, 20, 600, 400));
Console.WriteLine($"Print Paint result: {result}");
```

```vbnet
Dim result = tXBarcodeControl.PrintPaint(New System.Drawing.Rectangle(20, 20, 600, 400))
Console.WriteLine($"Print Paint result: {result}")
```

---

## Nearby

- **Previous:** [TXBarcodeControl.Load Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf-barcode/txbarcodecontrol/load-method/llms-full.txt)
- **Next:** [TXBarcodeControl.Save Method](https://docs.textcontrol.com/tx-text-control-dotnet-wpf/reference/txtextcontrol-wpf-barcode/txbarcodecontrol/save-method/llms-full.txt)
