i’m pretty new to WinForms and i need something for a project : i’m writing a test program for a device. The device sends some datas about itself and i have to output some informations about it in a tab and a chart. Here is the twist : the device can be a double, triple, or n-uple device wich means i’ll have to output n tabs and n charts.
For this i would like to have a "template" with a tab and a chart and put one for every sub-device, one under another in my winforms window. How do you think is this possible ? DO you have a better idea ?
I don’t know if i’m very clear so i added a picture to explain what i want.(https://i.stack.imgur.com/Nd00g.png)
Thank you
I tried to search the web for templates in winforms but found nothing that fits what i want.
>Solution :
Well, unfortunately windows Forms are based on inheritance.
So you cannot compose new behaviour in, but if you don’t mind inheritence,
simply create a child Form
And then use a Panel that will work as your base template, where you can add your chart, and your data.
Then you can either create as many children as you want, one pr type, OR you can compose different behaviour onto the panel, as you like.
I prefer the composing solution myself, as it at least attempts to be modern, but the problem is Forms are not really build for composition, so it would strictly speaking be better to continue in the inheritance paradigm, so everything is uniform.
However, Testing is much harder on inheritance. So I would like composition for that actually. Yes. Composition, is better.