On 13 Sep, 16:09, "Gav" <g...@nospam.co mwrote:
I am writing an application where I will have a TabControl and 3 styles of
Tabs to go in it, each containing different controls. The tabs will be added
to the tabcontrol when items are clicked on in a TreeView. So the the
application starts by displaying no tabs and adds them in as required. There
could be any number of each tab (0 upwards).
What is the best way of me doing this? Should I create 3 custom controls
that extend TabPage? I've only been doing this for a couple of days so any
advice would be great.
thanks
Gav
I'm not sure I fully understand what you want to do, but I can give
you an idea, and you'll decide if it fits for you.
I would create in designed a single TabControl containing ALL
possibile TabPages.
In form's constructor, right after calling InitializeCompo nent(), I
would initialize 3 arrays of TabPages. You must declare the array as
members of your form's class. Each array containg the combination of
TabPages that should be displayed when items are clicked in TreeView
control. I would set the Tag property of each TreeNode to the
corresponding array. This will help you later.
After initializing the arrays, you may clear all TabPages, so
initially, you have an empty TabControl.
When a TreeNode is selected, you just need to:
1. clear the TabPages in TabControl.
2. get the list of TabPages using TreeNode's Tag property and add the
pages to the TreeControl.
I didn't try this, but I don't see any reason it shouldn't work...
Hope it helps.