Show on All Tabs

When it’s developping a windows form application the “TabControl” is one of controls more used by me.

If you need to show same control that has same data es. a panel in the all or several tabs, you can change the parent of control at runtime, specifyng the tab selected.

The event to manage it is “Selected” from TabControl, see the following code:


private void tcColor_Selected(object sender, TabControlEventArgs e)
{
pnlRed.Parent = e.TabPage;
pnlOrange.Parent = e.TabPage;
pnlYellow.Parent = e.TabPage;
pnlGreen.Parent = e.TabPage;
pnlAcqua.Parent = e.TabPage;
pnlBlue.Parent = e.TabPage;
}

Leave a Reply

Your email address will not be published. Required fields are marked *