Click here to Skip to main content
15,895,799 members
Articles / Programming Languages / Visual Basic

AGE, Another Graphic Engine in .NET

Rate me:
Please Sign up or sign in to vote.
4.96/5 (36 votes)
10 May 2007CPOL8 min read 136.5K   5.9K   170  
A library that allows some GDI+ manipulation at runtime in an easy way
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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Italy Italy
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions