📜 ⬆️ ⬇️

AGE Component, Another Graphic Engine in .NET

So immediately to the point. The component can be obtained here and there is a description of it.
The component is not bad. Well draws, you can build a Canvas on which the whole thing is drawn. Beautiful draws, which is also a plus.




')

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

Those. after you have created your object and your paintr you’ll get the following:


I think it is 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 items, add instances of the type NeoDataType.Graphic.GraphicItem to the collection of elements contained in the component. To do this, we need a Canvas to refer to a GraphicDocument which contains a collection of our objects. The code is approximately as follows:

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


* This source code was highlighted with Source Code Highlighter .


Next will begin drawing your element on Canvas.

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 script preprocessor that allows you to draw elements with scripts. Script format can be viewed on the page of this control. To begin using the script, you should use an element of type ScriptedItem.

Any questions please contact.

Source: https://habr.com/ru/post/61930/


All Articles