Make dynamically number of tab pages with ZedGraph in WinForm C#

╄→гoц情女王★ 提交于 2019-12-13 03:59:28

问题


I have data for several days. I want to plot that data, one day in one tab page. The tab page can change dynamically corresponding with the number of the day.

Previously, I always make a static page in the design mode. I use ZedGraph control to plot the data. I decided how many pages that I need. Then it means the number of pages is static.

Now, I need more dynamically. I want the number of tab pages can change dynamically. Each page has similar controls inside it. How to do that? I have no clue about it.


回答1:


First you create a new class of type UserControl. These are meant to act as containers for controls. Then you put everything on it you need in your typical tabpage including the ZedGraph control..

Also write your logic there.

Now, when you need another page you create one and add a new instance of the UC class you have created.

You should think a little about dependencies with the rest of you application, including the deleting of the pages; a page controller class comes to mind that can handle these things, if necessary.

You could also subclass a tabpage but going the UC way gives go an additional layer of independency; you could place the same UC on a form or inside a container control..



来源:https://stackoverflow.com/questions/22829089/make-dynamically-number-of-tab-pages-with-zedgraph-in-winform-c-sharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!