Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visualisation of derived classes in C#

I have a base class (representing a real world container filled with small spheres) and some derived classes. This works just fine.
My problem is how to do their visualisation. I have a UserControl visualising the base class. Is the best solution to have a derived UserControl for each of the derived classes? Or is it better to have just one working for all of them?
Edit:
Apparently I was not specific enough. There is always the same basic appearance: rectangle with a lot of circles inside. The difference between the classes is how the container is filled. One type puts a seed in the middle and creates other spheres in a tree like structure - in this case the connecting lines between parents and their children should be drawn.
Generally there should be consistent look of the classes' visualisations with a few specialities for each derived type.

like image 860
Lukas Avatar asked Aug 03 '10 14:08

Lukas


Video Answer


1 Answers

This really depends a great deal on how similar the displays will be. If the displays of the derived classes are very similar to the base class then you only need the one UserControl to do the visiualization. OTOH, if each derived class needs to display unique things then you will be better off having a separate UserControl to visualize each derived class. I really can't be any more specific without more specific info on your classes.

EDIT: From your additional info I would say that you should have a base display class that draws the commom rectangular container then have derived UserControls that handle drawing the contents of each specific type.

like image 172
Bill W Avatar answered Oct 05 '22 04:10

Bill W