Diagramming for dummies

Hi, in the past months I’ve been working with the .Net framework either in C# and in C++/CLI. I’ve been more focused in the GUI part of the framework playing with controls and developing some simple ones. Now I needed to make a more challenging control that would draw diagrams, so I went looking for references and I found this great article http://www.codeproject.com/cs/miscctrl/NetronLight.asp by NetronProject. I liked the design of the code and decided to use it and make some modifications to my needs. Below you can find the modifications I did to the code.

Changelog (2006-04-02):

  • Added scroll bars (maybe a bit more of tuning is needed.)
  • Added type for connectors (none, input, output. An input connector can’t connect to another input connector and the same goes for the output connector.)
  • Added a new type of shape (the actionbox that has some inputs, in green, and outputs, in blue.)
  • You can indicate if a shape allows internal connections, i.e., a connection from two connectors within the same shape.
  • Delete key deletes the selected component.
  • When deleting a component, it will delete all connections associated with it.
  • The controls gains focus automatically as the mouse passes over it. This was added so we can use the mouse whell (for scrolling the scrollbars) and keyboard keys, like Delete, more easily.
  • Mouse cursor changes to a resizer when hovering a shape and to a hand when hovering a connector.
  • Fixed some problems with the drawing/refreshing of shapes, connections and connectors.

These modifications haven’t been fully tested yet so it’s most likely that you’ll find bugs in the control. If you find some please report them to me. With time I may add more things as I need, so if you interested in this control, just check this page from time to time.
You’re free to use this code as long as you don’t blame me for any changes/bugs that were introduced and don’t demand anything from me. Just download it here if you accept these conditions.

If you have any bugs/questions/comments/suggestions just send me an e-mail.
Before I go, I want to thank NetronProject team for this great control and tutorial.

References:

http://www.codeproject.com/cs/miscctrl/NetronLight.asp – Diagramming for dummies – The Code Project – C# Controls

Tagged , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *