Text Frames
View as MarkdownRender text in multiple columns and along a path using the Frames collection.
Code Snippet
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");
}
Output
TextFrames.png
Used APIs
- Aurigma.GraphicsMill.Bitmap.GetGraphics
- Aurigma.GraphicsMill.Drawing.CharStyle.Size
- Aurigma.GraphicsMill.Drawing.Graphics.DrawPath(Pen,Path)
- Aurigma.GraphicsMill.Drawing.Graphics.DrawText(Text)
- Aurigma.GraphicsMill.Drawing.Path
- Aurigma.GraphicsMill.Drawing.Path.CurveTo(Single,Single,Single,Single)
- Aurigma.GraphicsMill.Drawing.Path.DrawRectangle(Single,Single,Single,Single)
- Aurigma.GraphicsMill.Drawing.Path.MoveTo(Single,Single)
- Aurigma.GraphicsMill.Drawing.PathTextFrame
- Aurigma.GraphicsMill.Drawing.PathTextFrame.Baseline
- Aurigma.GraphicsMill.Drawing.Pen
- Aurigma.GraphicsMill.Drawing.ShapeTextFrame
- Aurigma.GraphicsMill.Drawing.ShapeTextFrame.Shape
- Aurigma.GraphicsMill.Drawing.Text
- Aurigma.GraphicsMill.Drawing.Text.CharStyle
- Aurigma.GraphicsMill.Drawing.Text.Frames
- Aurigma.GraphicsMill.Drawing.Text.String