简体   繁体   English

具有许多tabPages的tabcontrol c#

[英]tabcontrol with many tabPages c#

I'm looking for a function which get for input tabcontrol and tabpage index and will return if the tabPage header is shown or not (in case that there are extra pages and scrollbars appear, some of tabPages headers can be disappeared). 我正在寻找一个用于输入tabcontrol和tabpage索引的函数,如果不显示tabPage标头,该函数将返回(如果有多余的页面和滚动条出现,某些tabPages标头可以消失)。

does someone have a code for it? 有人有代码吗?

check the following code works on winForms, you can increase or decrease the scrollbarwidth variable to fit your opinion on how much size you will consider the page shown or not. 如果检查以下代码在winForms上是否可用,则可以增加或减小scrollbarwidth变量,以适合您对要考虑显示的页面大小的意见。

 private bool TabPageShown(TabControl tabCtrl, int tabIndex)
        {
             Rectangle rct = tabCtrl.GetTabRect(tabIndex);
             int scrollBarWidth = 24;
             if (rct.X - scrollBarWidth < tabCtrl.Width)
             {
                 return true;
             }
             else
             {
                 return false;
             }
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM