Managing tabs in a multiline tab control
-
Hi all, I have a tabcontrol with a lot of tabs which may be added and removed dynamically. I'm using a multiline tab control due to the amount of tabs involved, and I would like to simple be able to add a tab to either the top or bottom row of tabs programatically. Is that at all possible? Thanks..
-
Hi all, I have a tabcontrol with a lot of tabs which may be added and removed dynamically. I'm using a multiline tab control due to the amount of tabs involved, and I would like to simple be able to add a tab to either the top or bottom row of tabs programatically. Is that at all possible? Thanks..
ruanr wrote:
Is that at all possible?
Yup. Did you run into a non-working
insert
method? If yes, then there's a workaround[^].IntPtr h = tabControl.Handle;
tabControl.TabPages.Insert(0, "test");Alternatively, you could move pages around as shown below :)
var tabControl = new TabControl();
tabControl.Parent = this;
tabControl.Dock = DockStyle.Fill;
tabControl.Multiline = true;
Controls.Add(tabControl);// Create some tabs
tabControl.TabPages.Add("bla");
tabControl.TabPages.Add("bla2");
tabControl.TabPages.Add("bla3");// Swap tab 0 & 1
var temp = tabControl.TabPages[1];
tabControl.TabPages[1] = tabControl.TabPages[0];
tabControl.TabPages[0] = temp;I are Troll :suss: