---
title: "Wrapping Paths"
canonical: https://www.graphicsmill.com/samples/Text/TextLayout/WrappingPaths_cs
product: "Graphics Mill"
source: "Text/TextLayout/WrappingPaths.cs"
---

# Wrapping Paths

Illustrates the utilization of wrapping paths for excluding specific regions for text layout.

## Instruction

This code demonstrates how to wrap text inside a bounded rectangle with a wrapping path (ellipse).
The text is placed inside a defined rectangle (`RectangleF`) and wraps around the given path (an ellipse).
The path (`wrappingPath`) is drawn, and the text is wrapped according to the boundaries of the path.

## Usings

```csharp
using Aurigma.GraphicsMill.Drawing;
```

## Code Snippet

```csharp
using (var bitmap = new Bitmap(400, 400, PixelFormat.Format32bppArgb, RgbColor.White))
using (var gr = bitmap.GetGraphics())
{
    var wrappingPath = new Path();
    wrappingPath.DrawEllipse(180, 0, 70, 350);

    var text = new BoundedText(Texts.LoremIpsum, gr.CreateFont("Arial", 20))
    {
        Rectangle = new System.Drawing.RectangleF(50, 50, 300, 300),
    };

    text.WrappingPaths.Add(wrappingPath);

    gr.DrawRectangle(new Pen(RgbColor.Blue), text.Rectangle);
    gr.DrawPath(new Pen(RgbColor.Red), wrappingPath);

    gr.DrawText(text);

    bitmap.Save("WrappingPaths.png");
}
```

## Explanation

The code:

- Draws an ellipse as a wrapping path within the defined area for text.
- The text (`Texts.LoremIpsum`) is bounded within a rectangle and wrapped around the ellipse.
- Both the rectangle and ellipse are drawn as frames, and the final output is saved as "WrappingPaths.png".

## Tags

- [Drawing](<https://www.graphicsmill.com/samples/tags/drawing_md>): Drawing vector shapes and text
- [Text Layout](<https://www.graphicsmill.com/samples/tags/text-layout_md>): Controlling advanced text layout

## Output

- [WrappingPaths.png](<https://www.graphicsmill.com/samples/Text/compiled/Debug/WrappingPaths_png>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Bitmap.GetGraphics](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Bitmap_GetGraphics.htm.md>)
- [Aurigma.GraphicsMill.Drawing.BoundedText](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_BoundedText.htm.md>)
- [Aurigma.GraphicsMill.Drawing.BoundedText.Rectangle](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_BoundedText_Rectangle.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Graphics.CreateFont(String,Single)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_CreateFont_2_1dbfa9fa.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Graphics.DrawPath(Pen,Path)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_DrawPath_2_77634c23.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Graphics.DrawRectangle(Pen,RectangleF)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_DrawRectangle_2_169e24a7.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Graphics.DrawText(Text)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_DrawText_1_f576d03f.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Path](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_Path.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Path.DrawEllipse(Single,Single,Single,Single)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Path_DrawEllipse_4_37f6c741.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Pen](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_Pen.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Text.WrappingPaths](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_Text_WrappingPaths.htm.md>)
