2d editor in c#


J

Joao Barros

I know almost nothing about c#, although I know C++ quite well (I
think ;-)) and some Java.
As it seems c# is a good alternative to Java, I am trying to decide if
c# is a good option to the following:

- A simple 2d graphical editor allowing the drawing of rectangles,
circles, text objects, and arcs (lines with arrow points) between
them.
- Undo/redo,copy/paste and the usual related stuff
- Connectors between objects: for example, when I drag a rectangle I
want the connecting arcs to be dragged together with it.

What is the easiest way to achieve this in C#? Is there any code
example of something similar available? Some free library?

In Java there are some interesting code available. I specially liked
jhotdraw as it does what I need. Yet, if I can do it quickly in c# I
would like to know.

Thanks a lot in advance

Joao
 
Ad

Advertisements

V

Vijaye Raji

It's very easy to write one yourself.

I'd proceed with creating a Control class and derive all the specialized
objects (like rectanlge, circle, etc) from it. Then, I'd have a Designer
class that would host all the controls. The Drawing of the controls will be
orchestrated by the Designer by passing a Graphics object to each of the
embedded controls.

This way, you could implement project save/load very easily through
available Serializers.

For Undo & Redo, you can write a helper class that will record every action
on the designer. You could go one step further and provide transactions on
your UndoRedoHelper class. THis way, you can handle multiple
delete/copy/paste in one shot.

With some smart use of attributes (like Browsable, Category, Description,
etc.), you can add a property Grid to your main form that will hold the
currently selected object and you can change the objects properties (like
size, location, radius - if it's a circle, etc.) from the PropertyGrid
window.

Hope this helps.
vJ
 
Ad

Advertisements


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

C# directx 2d 5
2D graphics library c# 1
c# editor 3
A descent C# editor? 5
simple C# editor? 8
C# script editor 2
C/C++ editor control for .net 0
2d arrays 9

Top