Wrapping Paths

Drawing Text Layout

Illustrates the utilization of wrapping paths for excluding specific regions for text layout.

Сode Snippet

using (var bitmap = new Bitmap(400, 400, PixelFormat.Format32bppArgb, RgbColor.White))
using (var gr = bitmap.GetAdvancedGraphics())
{
    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");
}

Output

WrappingPaths.png

For AI-assisted development: Download Graphics Mill Code Samples XML Catalog