-1

NOTE: this question is not about using some premade libarys, so it's propably not a dublicate of Implementing a node-based graphical interface?


I'm trying to make a Node-Based-Interface like Autodesk 3DS MAX uses in the Material Editor :

enter image description here

so far i have some simple graphics ( .png ) for some nodes and i just finished the curved-line algorythm ( Cubic Bezier Curve )

All the logics, Classes and some other code are made 70 % till now, but i'm wondering what exactly would be the "right" way of implementing the Node Based Interface in a C# WinForm.

I've thought of using OpenGL or XNA ( Direct3D ), but then i thought that this would be a kind of too much for the purpose.

Next WPF came into my mind, but i've not worked with WPF for things like this anyway, so i've no idea if this would be makable and also nice in performance.

cuestions like, would i be able to drag around each nodes ? could i be able to register click and drag events with drawed graphics ?

I would like to be able to let the user create nodes, give them proppertys and values, connect the nodes and drag them arround in a scrolling area of the WinForm ( like in a container )

well, what are your suggestions ? where to begin ? what to do ? and maybe any examples or reference ?


EDIT:

here is an simple ( graphical ) example of the structure for the nodes i'm trying to make: enter image description here

as you can see, i want to have buttons inside a node, or other user controled elements like switches or something like a dimmer. note that this image is only for showing how i want to structure the nodes and each "rectangle".

so each rectangle should have it's own propertys ( signal = true / false , connectedNode = "node_id" ) and also it's own mouse events, i want to group all there rectangles to an object that will represent a node.

so my question is: HOW can i draw the rectangles inside a Control Element like a "Panel" ? ( im best case i would like to use .png's for the main rectangle and for the connector-rectangles instead of drawing plain color recrangles )


UPDATE: what is with the system.drawing class ? can i simply draw into a "Panel" element ? and what is with the dragability ?

Community
  • 1
  • 1
Ace
  • 1,437
  • 6
  • 28
  • 46

2 Answers2

1

first you need undestand mani tec is able to do what you need.

About performance is:

list ordered by better to worst

-xna or open gl - (Direct 3d or Direct X)
-windows forms (System.Windows.Forms)
-wpf

if you are interested in ease development the order starting from the simplest:

-wpf
-winforms
-xna (...)


To help you a little more i will say:

in Win Forms you can do a custom user control, and in user control you can override a protected method call onpaint, in this method you can perform a real time design that interacts with the movement and clicks of the mouse.

if you need more info about it just ask.

Jonny Piazzi
  • 3,684
  • 4
  • 34
  • 81
  • well first you should know that i'm familiar with xna, opengl and direcr3d, so lerning it is not the problem. what is mani tec ? is it a miss typing ? well i've also read som things about custom controlls, but i would like to be able to draw everything in a loop to update the curved lines as user drags the nodes. do you have any starting point ? – Ace Dec 16 '12 at 02:07
  • and for the custom control: do you have any example ? whats with the graphics ? for each anchor point of the node i want to be able to connect those, so each connection point must have it's own mouseover trigger and so on.. – Ace Dec 16 '12 at 02:08
1

You should be able to find mouse up and mouse down events that a custom Winforms user control can respond to. From that you should be able to implement click and drag (the control-relative position of the mouse click is usually passed in the event structure) and go from there.

I'd start by writing a small prototype of being able to drag around a single object and go from there - try a few different ways, see what's understandable and clean.

After you've got that you could start designing a class setup; you'll probably want to put a lot of your common drag/drop code in a base class that implements bounding boxes and similar, then create a list of objects/nodes/lines to draw and their associations. Just build your way up slowly; don't plan to build the entire thing in one shot.

ravuya
  • 8,586
  • 4
  • 30
  • 33
  • as i said , much of the logic is done allready, i'm just searching for a way of bringing that images i've made in a control element, either with xna, opengl ( tao framework ) or anything else. so custom controlls are recomented warious times, do you have any example of how i can bring up a graphic object, target it, and set each connection point's trigger ( mouse over, mouseup, .. ) ? – Ace Dec 16 '12 at 02:16