|
using System;
using System.Drawing;
using System.Drawing.Drawing2D;
using NeoDataType.Graphic;
using NeoDataType.Graphic.Drawing;
namespace GraphicTest
{
class TextPainter : Painter
{
protected override void Paint(System.Drawing.Graphics g)
{
GraphicText text = (GraphicText)Item;
Brush b = new LinearGradientBrush(Item.Bounds, Color.Azure, Color.LightBlue, 45);
Pen p = new Pen(Color.LightBlue, 3);
ExtendedGraphics xg = new ExtendedGraphics(g);
Rectangle r = Item.Bounds;
StringFormat sf = new StringFormat();
if (text.CenterText)
{
sf.Alignment = StringAlignment.Center;
sf.LineAlignment = StringAlignment.Center;
}
xg.DrawRoundRect(p, b, r.X, r.Y, r.Width, r.Height, 20);
g.DrawString(text.Text, text.Font, Brushes.Blue, r, sf);
b.Dispose();
p.Dispose();
sf.Dispose();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.