简体   繁体   English

如何将选项卡页动态添加到tabcontrol的开头

[英]How to add tabpages dynamically to the beginning of the tabcontrol

I have a tab control that I can programmatically add and remove tabs from. 我有一个标签控件,可以通过编程方式添加和删除标签。 It works fine but whenever I add a tab this tab is added end of the tab list. 它工作正常,但是每当我添加一个选项卡时,都会将此选项卡添加到选项卡列表的末尾。 How can I add tabs beginning of the tabList dynamically. 如何动态地在tabList的开头添加标签。

This is the code I use to add tabs: 这是我用来添加标签的代码:

private void button1_Click(object sender, EventArgs e)
    {
        tabControl1.TabPages.Add("Kare");

    }

Thanks from now. 从现在开始谢谢。

I finally solved it: 我终于解决了:

you should change your code to that: 您应该将代码更改为:

tabControl1.TabPages.Insert(0,"Başlık");

let me explain what it means insert is like add but instead of adding tabs to the end of the list it allows the user to choose where the tab will be added. 让我解释一下插入是什么意思,就像添加,但不是将选项卡添加到列表的末尾,而是允许用户选择将选项卡添加到的位置。 In my case it will be the beginning of the tab list. 就我而言,这将是选项卡列表的开始。 0 means beginning of the list or the first tab and "Başlık" stands for the name of my tab. 0表示列表或第一个标签的开头,“Başlık”代表我的标签的名称。

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

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