Bounded Text
View as MarkdownDemonstrates how to use bounded text.
Code Snippet
using (var bitmap = new Bitmap(250, 250, PixelFormat.Format24bppRgb, new RgbColor(255, 255, 255, 255)))
using (var graphics = bitmap.GetGraphics())
{
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
Used APIs
- Aurigma.GraphicsMill.Bitmap.GetGraphics
- Aurigma.GraphicsMill.Drawing.BoundedText
- Aurigma.GraphicsMill.Drawing.BoundedText.Rectangle
- Aurigma.GraphicsMill.Drawing.Graphics.CreateFont(String,Single)
- Aurigma.GraphicsMill.Drawing.Graphics.DrawRectangle(Pen,RectangleF)
- Aurigma.GraphicsMill.Drawing.Graphics.DrawText(Text)
- Aurigma.GraphicsMill.Drawing.Pen
- Aurigma.GraphicsMill.Drawing.SolidBrush