jeudi 26 mars 2015

Create a Winforms Flowchart Control when performance matters: Set of controls / Handle everything manually (painting, user interactions, etc.)


I am currently trying to create a Flowchart / Diagram Control (e.g. NShape) and I am struggling about what to use to manage the primitives (rectangle, rounded rectangle, square, circle, arrows, etc) and their respective user interactions (drag-and-drops, re-sizing, texture, etc.).


Is it better for performance matters to use a set a control for each of them? Therefore, a dummy hierarchy with a Shape Control as a base class can designed and other related paintings and region definitions defined in sub-classes.


On one hand, the good thing is that in this way, I can provide a very simple way to handle the user interactions through the events available in the Control class. In the past, I've already had done something pretty close to this approach and that was pretty straightforward.


On the other hand, I am not sure it is really performance-wise since there is a need to create hundreds of controls and therefore a lot of handles. At the same-time, it seems like doing otherwise is like re-inventing a lot the wheel and not taking any advantage of what is already existing and the point is that I do not feel quite confident to start something brand new to make it performant enough with a pretty low footprint, i.e. generating 300 primitives without having the canvas becoming sluggish when the user is about to interact with them.


Any insights about what I want to achieve?





Aucun commentaire:

Enregistrer un commentaire