---
title: "Plain Text"
canonical: https://www.graphicsmill.com/samples/Text/TextLayout/PlainText_cs
product: "Graphics Mill"
source: "Text/TextLayout/PlainText.cs"
---

# Plain Text

Demonstrates how to use plain text.

## Instruction

This code demonstrates how to render both horizontal and vertical text using the `PlainText` class.
The horizontal text is displayed normally, while the vertical text is rotated to be drawn vertically.
A glow effect is applied to the vertical text, and a red ellipse is drawn around the text positions for visualization.

## Usings

```csharp
using Aurigma.GraphicsMill.Drawing;
using Aurigma.GraphicsMill.Drawing.Effects;
```

## Code Snippet

```csharp
using (var bitmap = new Bitmap(400, 250, PixelFormat.Format24bppRgb, new RgbColor(255, 255, 255, 255)))
using (var graphics = bitmap.GetGraphics())
{
    var brush = new SolidBrush(new RgbColor(0x41, 0x41, 0x41));

    var texts = new PlainText[]
    {
        new PlainText("Horizontal text\nwith two lines", graphics.CreateFont("Times New Roman", 22f), brush)
        {
            Position = new System.Drawing.PointF(50f, 38f),
        },
        new PlainText("Vertical", graphics.CreateFont("Arial", 24f), brush)
        {
            Vertical = true,
            Position = new System.Drawing.PointF(20f, 10f),
            Effect = new Glow(new RgbColor(0x66, 0xaf, 0xe9), 5),
        },
    };

    foreach (var text in texts)
    {
        graphics.DrawEllipse(new Pen(RgbColor.Red, 2), text.Position.X - 1, text.Position.Y - 1, 2, 2);
        graphics.DrawText(text);
    }

    bitmap.Save("PlainText.png");
}
```

## Explanation

The code:

- Creates a 400x250 pixel bitmap with a white background.
- Draws horizontal text with two lines using the `PlainText` class (Times New Roman font, 22pt).
- Draws vertical text with a glow effect using the `PlainText` class (Arial font, 24pt).
- Adds a red ellipse around the positions of the texts for reference.
- Saves the resulting image as "PlainText.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

- [PlainText.png](<https://www.graphicsmill.com/samples/Text/compiled/Debug/PlainText_png>) (preview)

## Used APIs

- [Aurigma.GraphicsMill.Bitmap.GetGraphics](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Bitmap_GetGraphics.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Effects.Glow](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_Effects_Glow.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.DrawEllipse(Pen,Single,Single,Single,Single)](<https://www.graphicsmill.com/docs/gm/M_Aurigma_GraphicsMill_Drawing_Graphics_DrawEllipse_5_b3708ac1.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.Pen](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_Pen.htm.md>)
- [Aurigma.GraphicsMill.Drawing.PlainText](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_PlainText.htm.md>)
- [Aurigma.GraphicsMill.Drawing.PlainText.Position](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_PlainText_Position.htm.md>)
- [Aurigma.GraphicsMill.Drawing.PlainText.Vertical](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_PlainText_Vertical.htm.md>)
- [Aurigma.GraphicsMill.Drawing.SolidBrush](<https://www.graphicsmill.com/docs/gm/T_Aurigma_GraphicsMill_Drawing_SolidBrush.htm.md>)
- [Aurigma.GraphicsMill.Drawing.Text.Effect](<https://www.graphicsmill.com/docs/gm/P_Aurigma_GraphicsMill_Drawing_Text_Effect.htm.md>)
