---
title: "Text Frames"
canonical: https://www.graphicsmill.com/samples/Text/TextLayout/TextFrames_cs
product: "Graphics Mill"
source: "Text/TextLayout/TextFrames.cs"
---

# Text Frames

Render text in multiple columns and along a path using the Frames collection.

## Instruction

This code demonstrates how to create and render text in multiple shapes and along a path using `Text`, `ShapeTextFrame`, and `PathTextFrame` classes.
Two rectangular shapes are defined for text frames, and a curved path is used for rendering text along the path.
The text is displayed within these shapes and along the path, with all paths outlined for visualization.

## Usings

```csharp
using Aurigma.GraphicsMill.Drawing;
```

## Code Snippet

```csharp
var text = new Text();
text.String = Texts.LoremIpsum;
text.CharStyle.Size = 40;

var textShape1 = new Path();
textShape1.DrawRectangle(20, 20, 270, 450);

var textShape2 = new Path();
textShape2.DrawRectangle(310, 20, 270, 450);

var shapeTextFrame1 = new ShapeTextFrame()
{
    Shape = textShape1,
};

var shapeTextFrame2 = new ShapeTextFrame()
{
    Shape = textShape2,
};

text.Frames.Add(shapeTextFrame1);
text.Frames.Add(shapeTextFrame2);

var textPath = new Path();
textPath.MoveTo(20, 580);
textPath.CurveTo(250, 500, 480, 580);

var pathText = new PathTextFrame()
{
    Baseline = textPath,
};

text.Frames.Add(pathText);

using (var bitmap = new Bitmap(600, 600, PixelFormat.Format32bppArgb, RgbColor.White))
using (var gr = bitmap.GetGraphics())
{
    gr.DrawPath(new Pen(RgbColor.Blue), textShape1);
    gr.DrawPath(new Pen(RgbColor.Blue), textShape2);

    gr.DrawPath(new Pen(RgbColor.Blue), textPath);

    gr.DrawText(text);

    bitmap.Save("TextFrames.png");
}
```

## Explanation

The code:

- Creates two rectangular paths for text shapes (text is fitted inside these rectangles).
- Adds these shapes as `ShapeTextFrame` to the `Text` object.
- Creates a curved path for placing text along the path and adds it as a `PathTextFrame`.
- Draws the paths outlining the shapes and the curved path using a blue pen for visualization.
- Renders the text inside the defined shapes and along the path.
- Saves the result as "TextFrames.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

- [TextFrames.png](<https://www.graphicsmill.com/samples/Text/compiled/Debug/TextFrames_png>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Bitmap.GetGraphics](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Bitmap_GetGraphics.htm.md>)
- [Aurigma.GraphicsMill.Drawing.CharStyle.Size](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_CharStyle_Size.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.Path](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_Path.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Path.CurveTo(Single,Single,Single,Single)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Path_CurveTo_4_37f6c741.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Path.DrawRectangle(Single,Single,Single,Single)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Path_DrawRectangle_4_37f6c741.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.PathTextFrame](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_PathTextFrame.htm.md>)
- [Aurigma.GraphicsMill.Drawing.PathTextFrame.Baseline](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_PathTextFrame_Baseline.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Pen](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_Pen.htm.md>)
- [Aurigma.GraphicsMill.Drawing.ShapeTextFrame](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_ShapeTextFrame.htm.md>)
- [Aurigma.GraphicsMill.Drawing.ShapeTextFrame.Shape](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_ShapeTextFrame_Shape.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Text](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_Text.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Text.CharStyle](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_Text_CharStyle.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Text.Frames](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_Text_Frames.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Text.String](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_Text_String.htm.md>)
