Introduction

This library lets you manipulate graphic objects in your app at runtime.

Background

Sometime ago, I read that someone had asked for a way to drag items over a panel. Since I had the same problem (all began with the designer of MyNeoReport project) I tried to solve this in a generic way, so that the system could be used in different applications without efforts.

AGE supports items dragging, snap-to-grid, multiselection, layers and much more.AGE is growing fast; if I were you I would keep an eye on this project.

Principal Subjects

GraphicItem: The item to be drawn

Painter: The class that does the "dirty work" of painting

GraphicDocument: The class that collects all the items to be drawn on a single surface

Canvas: The control that shows the drawing

Why This Set of Class?

Q: Why do I need an RendererBase and why don't I put the Render() method directly to the GraphicItem class?A: Because I need more abstraction.In this way I separate the logical item from the actor of the rendering.I can virtually have the same renderer for different items or I can choose a different renderer for a single item.

Q: Why is the GraphicDocument a separate class from Canvas? I could add all the items to draw directly to the Canvas.A: Same reason of the first question: the GraphicDocument is the logical items aggregation, it is the document, the canvas is the surface on which the document is drawn.And again, in this way, I could have the same document open on more canvas.

Ok, Let's Start... How Does It Work?

Q: How can I make my own graphic document?A: Ok, let's define a complete new custom document:

References

History

For any questions or suggestions, please go to my Web site forum.

1.5.0.0

I'm sorry, this release is not 100% compatible with 1.4.0.0 C but, you should not have problems with it. I changed some property names, so I chose to change the version number, and you need to recompile applications that use AGE engine.

If you have some documents to be loaded, you must edit them with Notepad and replace the properties that were renamed (listed below).

Added:

GraphicItem.RotationCenter, GraphicItem.RotationCenterRelativeTo that let you define the center of the rotation angle

Stroke.RotationCenter, with ScriptAGE you can define a rotation point for each single stroke

Canvas QueryCursor event that lets you know about the cursor state and lets you set your custom cursor

Image Stroke

Text Scripted Stroke beta (not fully working yet)

Theme and DefaultTheme classes that let you define the canvas appearance (Thanks to Itai Bar-Haim)

Canvas.Zoom property (Thanks to Itai Bar-Haim)

Drag handlers on each side of selected items (Thanks to Itai Bar-Haim)

Fixed:

Canvas.Cursor is now readonly and reflects the cursor state at runtime

Drag is only allowed with left mouse button (right and center buttons can be used for other purposes)

GraphicItem.Angle were renamed in GraphicItem.RotationAngle

Stroke.Angle were renamed in Stroke.RotationAngle

Canvas.GridSize was renamed to Canvas.SnapGridSize to avoid conflicts with the Visual Studio designer GridSize property

ScriptAGE fixed for stroke and item properties

A lot of other bugs

Tested on Linux Ubuntu 7.4 + Mono 1.2.3.1: the engine works well, the designer needs some workaround since Mono does not completely support the TreeView (not implemented TreeView.Sort(), TreeView.NodeMouseDoubleClick event, TreeView.NodeMouseClick() event)

1.4.0.0 Release C

In this release, I enhanced ScriptAge again.ScriptAge is 100% compatible with the 1.4.0.0 release.

Now ScriptAge can define strokes formed by multiple figures

This lets you make a stroke formed by curves and lines together

Added path, radial, elliptic brush types

Brushes now can have more than 2 colors

Scriptage is now extensible: you can define your own PaintStroke class

1.4.0.0 Release B

From now, I'll mark the AGE engine with the AssemblyDescriptionAttribute to indicate the sub-release. This is because from 1.4.0.0, I signed the assembly with a strong name and I can no longer modify the release number for compatibility reasons.

In this release, I enhanced ScriptAge (see the References section).ScriptAge is 100% compatible with the 1.4.0.0 release.

Now ScriptAge supports comments, image token, multiline tokens, and more

Some minor ScriptAge and Canvas fixes

Added Canvas ItemMouseEnter and ItemMouseExit events

Fixed a bug with the Drag & Drop of controls on the Canvas at design-time

1.4.0.0

This release let me add an heavy improvement to the flexibility of this library allowing you to define an item directly at runtime.

Added ScriptedItem class that lets you define the graphic with a little script

A bunch of code clean up

1.3.0.0

This time, the major change is the possibility to write custom items into separate libraries that can be loaded by the document at runtime.

Added:

virtual GraphicItem.PointIsOverMe() that lets you define if a point lies over the item

Size GraphicItem.MinSize that lets you define the minimum size of an item

class SelectionPainter and GraphicItem.SelectionPainter that lets you customize the selection border of your item

virtual Document.LoadLibrary() that lets you import GraphicItems from external DLLs

GraphicLayer Canvas.ActiveLayer

bool Canvas.AllowUserEditItems and bool Canvas.AllowUserScrollCanvas that lets you decide if the user can manipulate canvas content and how

Comments and Discussions

Hi, i made an Autocad importer using AGE script. The problem is on small objects, the importer works only on integer format(pixels)so I multiply coordinates by 100. Objects must have the same scale, so if I multiply big object by 100 it goes too big. I found an idea to solve this problem by scale all document(with imported object). So how could resize all document? After importing I save document to database and load it. It save with this code: _document.GetDocumentString().