473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

2d editor in c#

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
Nov 15 '05 #1
4 6341
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

"Joao Barros" <jp****@sapo.pt> wrote in message
news:3c**************************@posting.google.c om...
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

Nov 15 '05 #2
You might want to take a look atthe GDI+ FAQ and the article on
"Manipulating Graphics" which delves into this subject a bit.

--
Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"Joao Barros" <jp****@sapo.pt> wrote in message
news:3c**************************@posting.google.c om...
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

Nov 15 '05 #3
Check out the link:
http://msdn.microsoft.com/library/de...ignsurface.asp

The example is in VB, but it isn't difficult to convert.

/qb

Joao Barros wrote:

- 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

Nov 15 '05 #4
The Netron Project is open source and has all you need to make graphical editors:
http://netron.sourceforge.net

--
Composed with Newz Crawler 1.5 http://www.newzcrawler.com/
Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Ed Suominen | last post by:
I'm thinking of implementing a real-time collaborative text editor in Python using Twisted. An initial plan is to use a Twisted PB server daemon that accepts user:password:file connections from...
3
by: Chris Cioffi | last post by:
I started writing this list because I wanted to have definite points to base a comparison on and as the starting point of writing something myself. After looking around, I think it would be a...
7
by: Mike Kamermans | last post by:
I hope someone can help me, because what I'm going through at the moment trying to edit XML documents is enough to make me want to never edit XML again. I'm looking for an XML editor that has a...
15
by: JC Home | last post by:
Hi all, I am just learning JavaScript and would love to find a good editor that helps with syntax and debugging. Any suggestions? Thanks!! -- Jeff Ciaccio Dallas, GA
71
by: tomy_baseo | last post by:
I'm new to HTML and want to learn the basics by learning to code by hand (with the assistance of an HTML editor to eliminate repetitive tasks). Can anyone recommend a good, basic HTML editor that's...
0
by: 356523600 | last post by:
HTML To PHP Converter 4.2.1.8 Free download Get more for less ... HTML To PHP Converter 4.2.1.8 Get more for less! With a new version of HTML To PHP Converter 4, we've dropped the price and given...
1
by: Steve Teeples | last post by:
I have class that also uses a custom editor that, when compiled directly into my project, works just fine in a propertygrid. However, it was necessary to place that class into a DLL, hense the...
4
by: David Lozzi | last post by:
Howdy, I'm using a WYSIWYG editor called TinyMCE. When I edit some text and then save it back to my SQL server using a SQLCommand, all HTML characters are changed to HTML code, i.e. &gt;strong&lt;...
7
by: Prasad | last post by:
Hi all, I am trying to develop a simple rich text editor I do only require bold, itlaic, underline.. The code for IE is <script> function displayEditor(editor, html, width, height) { ...
3
by: danesh1354 | last post by:
Hi All, First I need to construct a text editor by python programming and add this code to a biger code that has been written before, and i would like that by my code for this editor have a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.