C# TabPage 继承
我有两节课。第一类有TabPage控件。我想更改子类(B 类)中 TabPage 的布局。例如如何向 Child 类中的 tabPage 控件添加简单按钮?
Class A
{
TabPage a;
}
Class B : Class A
{
}
I have two classes. First class has TabPage control. I want to change layout of TabPage in Child class(Class B). For example how to add simple button to tabPage control in Child class?
Class A
{
TabPage a;
}
Class B : Class A
{
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将 TabPage 更改为公开
Change the TabPage to public
首先你需要将A类中的TabPage设为public,然后在你的
TabPage
控件集合中添加你想要添加的控件;在此示例中,我向TabPage
添加了一个按钮,您可以类似地添加更多控件。这实际上取决于您的情况,如果您也希望从基类访问 TabPage,请将其设为公共,否则将受到保护。
受保护
First you need to have TabPage in Class A to be public, then add the controls you want to add in your
TabPage
control collection; in this example i have added a button to theTabPage
you can add many more controls similarly.It really depends upon your situation, if you want to have TabPage accessible from base class too, make it public otherwise protected.
For protected