本文介绍了选项卡控制问题(C#)帮助我...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好..

我是新来的.我在使用Tab键控制时遇到了一些问题.这是问题所在...
我在表单中添加了一个带有3个标签的新标签控件.我想在默认视图上隐藏tabpage2,所以我在formload事件中编写了tabpage2.dispose()方法.
现在我想通过单击位于tabpage1中的按钮来查看该页面.(tabpage1是默认视图),所以我写道,


1. tabpage2.show();
2. tabcontrol.selectedtab = tabpage2;
3. tabpage2.select();


但是我再也无法获取该标签页.所以,现在该怎么办?

hi everyone..

I''m new here. i got a little problem with tab controlling.here is the problem...
I''ve added a new tab control with 3 tabs to my form. i want to hide tabpage2 on default view so I wrote tabpage2.dispose() method in formload event.
now I want to view that page by clicking a button placed in tabpage1.(tabpage1 is the default view) so i wrote,


1. tabpage2.show();
2. tabcontrol.selectedtab = tabpage2;
3. tabpage2.select();


but I couldn''t get that tabpage again.so, what should I do now??

推荐答案

public partial class Form1 : Form
{
    TabPage t1;
    private void Form1_Load(object sender, EventArgs e)
    {
        t1 = tabControl1.TabPages[1];
        tabControl1.TabPages.RemoveAt(1);
    }
    private void button1_Click(object sender, EventArgs e)
    {
        tabControl1.TabPages.Insert(1, t1);
    }
}



这篇关于选项卡控制问题(C#)帮助我...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-22 06:40