AGE Component, Another Graphic Engine in .NET

Published on June 12, 2009

AGE Component, Another Graphic Engine in .NET

    So right to the point. The component can be obtained here and there is a description of it.
    The component is not bad. He draws well, you can configure Canvas on which the whole thing is drawn. Beautifully draws, which is also a plus.






    In order for you to start working with it, you need to add the component included in the NeoDataType.Graphics assembly. After that, you throw on the form the component of drawing elements (Canvas). The component can draw objects inherited from NeoDataType.Graphic.GraphicItem. This type has a reference to an object of the NeoDataType.Graphic.Painter type, it is in this class that you render the object.
    NeoDataType.Graphic.Painter has a link to NeoDataType.Graphic.GraphicItem.

    Those. after you have created your object and your peynter the following will turn out:


    I think it’s clear what happened. The implementation is here:

    public class TestPainter : NeoDataType.Graphic.Painter
    {
     protected override void  Paint(System.Drawing.Graphics g)
     {
      TestPObject item = (TestPObject) Item;
      g.DrawLine(item.Pen, item.Bounds.Left, item.Bounds.Top, item.Bounds.Right, item.Bounds.Bottom);
     }
    }

    public class TestPObject : NeoDataType.Graphic.GraphicItem
    {
     public  Pen Pen{ get; set;}
     public  TestPObject()
     {
      Painter = new TestPainter();
     }
    }

    * This source code was highlighted with Source Code Highlighter.


    In order for the component to start drawing your elements, add instances of the NeoDataType.Graphic.GraphicItem type to the collection of elements contained in the component. To do this, we at Canvas need to turn to GraphicDocument which contains a collection of our objects. The code is something like this:

    cnvMain.Document = new GraphicDocument();
    cnvMain.Document.AddItem(new TestPObject(){Pen = Pens.Black});

    * This source code was highlighted with Source Code Highlighter.


    Next, the drawing of your element on the Canvas will begin.

    I used this component in my diploma for drawing printed circuit boards. Everything was great.

    The most important advantage of this component is that it has a scripted preprocessor that allows you to draw elements with scripts. The script format can be viewed on the page of this control. To start using a script, you should use an element of type ScriptedItem.

    Any questions, please contact.