在Tab控件中隐藏/显示单个tabPage的最佳方法? [英] Best method to hide/show a single tabPage in a Tab control?

查看:136
本文介绍了在Tab控件中隐藏/显示单个tabPage的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


这可能是一个简单的问题,但我无法弄明白这一点

远。我在Windows窗体应用程序上有一个选项卡控件。根据一些

业务逻辑,我需要隐藏/显示一些单独的标签。


标签页没有可见标签。属性。 tabpage类有一个hide

方法,但这似乎并没有让它消失。我已经能够通过以下方式移除它们:


this.tabControl1.Controls.Remove(myTab);

......但是我不确定如何把它放回去。

有人能告诉我如何隐藏&动态显示标签页?

我必须遗漏一些明显的东西。


谢谢

Robb

Hello,

This is probably an easy one, but I have not been able to figure it out so
far. I have a tab control on a windows forms app. Depending on some
business logic, I need to hide/show some of the individual tabs.

The tab page has no "visible" property. The tabpage class has a "hide"
method, but this does not seem to make it disappear. I have been able to
remove them via something like this:

this.tabControl1.Controls.Remove( myTab );

...but then I''m not sure how to put it back.
Can someone clue me in on how to hide & show tab pages dynamically?
I must be missing something obvious.

thanks
Robb

推荐答案

您好Robb,


首先,我想确认一下我对您的问题的理解。从

您的描述中,我了解您需要知道如何隐藏标签页

并再次显示。如果有任何误解,请随时告诉我




标签页有可见属性,但是对于某些已知问题它没有显示<智能感知器中的
。调用Hide方法与设置相同

可见为false;但是,在标签页控件上,隐藏方法会隐藏标签页中的所有控件,但会使标签页本身可见。这个

是您在以下知识库文章中看到的设计行为。

http://support.microsoft.com/?id=834616


如果您需要隐藏标签页,你必须从

tabControl.TabPages集合中删除它。如果您需要再次显示

,请将其添加回来。 TabPages集合没有Insert方法。页面将

添加到集合的最后一个。在这种情况下,我建议您删除

所有的标签页并按顺序重新添加。


HTH。


Kevin Yu

=======

此帖子已提供按原样没有保证,并且不授予

权利。

Hi Robb,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know how to hide a tabpage
and show it again. If there is any misunderstanding, please feel free to
let me know.

The tabpage has Visible property, but for some known issue it was not shown
in the intellisense. Calling the Hide method does the same thing as setting
Visible to false; However, on the tabpage control, the Hide method hides
all the controls in the tabpage but leave the tabpage itself visible. This
is the designed behavior as you can see in the following KB article.

http://support.microsoft.com/?id=834616

If you need to hide the tabpage, you have to remove it from the
tabControl.TabPages collection. And add it back if you need to show it
again. The TabPages collection doens''t have an Insert method. The page will
be added to the last of the collection. In this case, I suggest you remove
all the tabpages and re-add them by order.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


我昨天也在互联网上寻找这个。我找到了一些

复杂的解决方法但在我的应用程序中并不容易。


我终于从 www.softelvdm.com 它的工作原理只需

罚款。


对于我正在进行的项目,它只是更快。
I was all over the Internet yesterday looking for this, too. I found some
complicated workarounds but nothing easy in my app.

I finally bought the tab control from www.softelvdm.com and it works just
fine.

For the project I''m working on, it was just faster.


你看到了吗?
http://dotnetrix.co.uk/tabcontrols.html


我的TabControlEX是免费的,可能会做你想要的。
http:// dotnetrix .co.uk / controls.html


-

Mick Doherty
http://dotnetrix.co.uk/nothing.html

" John Davies" <乔******** @ discussions.microsoft.com>在消息中写道

news:61 ********************************** @ microsof t.com ...
Did you look here?
http://dotnetrix.co.uk/tabcontrols.html

My TabControlEX is free and would probably have done what you want.
http://dotnetrix.co.uk/controls.html

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"John Davies" <Jo********@discussions.microsoft.com> wrote in message
news:61**********************************@microsof t.com...
我昨天也在互联网上寻找这个。我找到了一些复杂的解决方法但在我的应用程序中并不容易。

我终于从 www.softelvdm.com 它的工作原理很好。

对于我正在研究的项目,它只是更快。
I was all over the Internet yesterday looking for this, too. I found some
complicated workarounds but nothing easy in my app.

I finally bought the tab control from www.softelvdm.com and it works just
fine.

For the project I''m working on, it was just faster.



这篇关于在Tab控件中隐藏/显示单个tabPage的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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