Bounded Text
Demonstrates how to use bounded text.
Сode Snippet
using (var bitmap = new Bitmap(250, 250, PixelFormat.Format24bppRgb, new RgbColor(255, 255, 255, 255)))
using (var graphics = bitmap.GetAdvancedGraphics())
{
var brush = new SolidBrush(new RgbColor(0x41, 0x41, 0x41));
var boundedTextRect = new System.Drawing.RectangleF(20f, 20f, 180f, 150f);
var text = new BoundedText(Texts.LoremIpsum, graphics.CreateFont("Verdana", 14f), brush)
{
Rectangle = boundedTextRect,
};
graphics.DrawText(text);
graphics.DrawRectangle(new Pen(new RgbColor(0x4e, 0xb5, 0xe6)), boundedTextRect);
bitmap.Save("BoundedText.png");
}
Output
BoundedText.png
For AI-assisted development: Download Graphics Mill Code Samples XML Catalog