---
title: "Path Text"
canonical: https://www.graphicsmill.com/samples/Text/TextLayout/PathText_cs
product: "Graphics Mill"
source: "Text/TextLayout/PathText.cs"
---

# Path Text

Draws text on a path.

## Instruction

This code demonstrates how to draw text along a custom path using the `PathText` class. The text is positioned along a Bezier curve path with specific start and end points.
It also showcases styling the path and text using a crimson-colored pen and a solid black brush.

## Usings

```csharp
using Aurigma.GraphicsMill.Drawing;
```

## Code Snippet

```csharp
using (var bitmap = new Bitmap(400, 250, PixelFormat.Format24bppRgb, new RgbColor(255, 255, 255, 255)))
using (var graphics = bitmap.GetGraphics())
{
    var pathText = new PathText("TEXT ON PATH", graphics.CreateFont("Arial", 36))
    {
        Pen = new Pen(RgbColor.Crimson, 1),
        Brush = new SolidBrush(new RgbColor(0x41, 0x41, 0x41)),
        ParagraphStyle = new ParagraphStyle() { Alignment = TextAlignment.Left },
        Stretch = false,
        Start = 0.2f,
        End = 1.0f,
        AutoExtend = false,
    };

    pathText.Path.MoveTo(26, 230);
    pathText.Path.CurveTo(126, 300, 226, 21, 426, 221);

    graphics.DrawPath(new Pen(RgbColor.Blue), pathText.Path);
    graphics.DrawText(pathText);

    bitmap.Save("PathText.png");
}
```

## Explanation

The code:

- Creates a 400x250 pixel bitmap with a white background.
- Defines a text ("TEXT ON PATH") to be drawn along a Bezier curve path.
- Uses the `PathText` class to position the text along the defined path.
- Draws the path in blue and the text along it using a black brush and crimson-colored pen.
- Saves the image as "PathText.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

- [PathText.png](<https://www.graphicsmill.com/samples/Text/compiled/Debug/PathText_png>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Bitmap.GetGraphics](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Bitmap_GetGraphics.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.DrawText(Text)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_DrawText_1_f576d03f.htm.md>)
- [Aurigma.GraphicsMill.Drawing.ParagraphStyle](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_ParagraphStyle.htm.md>)
- [Aurigma.GraphicsMill.Drawing.ParagraphStyle.Alignment](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_ParagraphStyle_Alignment.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Path.CurveTo(Single,Single,Single,Single,Single,Single)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Path_CurveTo_6_1e65d9e1.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Path.MoveTo(Single,Single)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Path_MoveTo_2_427c5821.htm.md>)
- [Aurigma.GraphicsMill.Drawing.PathText](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_PathText.htm.md>)
- [Aurigma.GraphicsMill.Drawing.PathText.AutoExtend](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_PathText_AutoExtend.htm.md>)
- [Aurigma.GraphicsMill.Drawing.PathText.End](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_PathText_End.htm.md>)
- [Aurigma.GraphicsMill.Drawing.PathText.Path](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_PathText_Path.htm.md>)
- [Aurigma.GraphicsMill.Drawing.PathText.Start](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_PathText_Start.htm.md>)
- [Aurigma.GraphicsMill.Drawing.PathText.Stretch](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_PathText_Stretch.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Pen](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_Pen.htm.md>)
- [Aurigma.GraphicsMill.Drawing.SolidBrush](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_SolidBrush.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Text.Brush](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_Text_Brush.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Text.ParagraphStyle](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_Text_ParagraphStyle.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Text.Pen](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_Text_Pen.htm.md>)
- [Aurigma.GraphicsMill.Drawing.TextAlignment](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_TextAlignment.htm.md>)
