在WinForm C#中使用ZedGraph动态生成选项卡页数 [英] Make dynamically number of tab pages with ZedGraph in WinForm C#

查看:149
本文介绍了在WinForm C#中使用ZedGraph动态生成选项卡页数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几天的数据.我想一天在一个标签页中绘制该数据.标签页可以根据天数动态更改.

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.

以前,我总是在设计模式下制作一个静态页面.我使用ZedGraph控件绘制数据.我决定需要多少页.这意味着页面数是静态的.

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.

推荐答案

首先,您创建一个类型为UserControl的新类.这些旨在充当控件的容器.然后,将您需要的所有内容放到典型的选项卡页面中,包括ZedGraph控件.

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.

现在,当您需要另一个页面时,可以创建一个页面,并添加一个已创建的UC类的新实例.

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.

您也可以继承标签页的子类,但采用UC方式可以使附加的独立性层化.您可以将相同的UC放置在窗体上或容器控件内.

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..

这篇关于在WinForm C#中使用ZedGraph动态生成选项卡页数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆