Preventing a predesigned tab in a TabControl from loading
Forgive the probably silly question - I'm not used to working with GUIs.
I've got a TabControl that's been prebuilt in the designer. There are many tabs, but only certain ones need to show up based on a variable at the time of loading the form. I originally tried using the Remove command on the FormLoad to remove the 开发者_如何学Pythonunneeded tabs, but because there are multiple tabs with multiple additional objects in each tab, they visibly load and then disappear and it's rather ugly.
Thank you.
Call Remove
in the form constructor, right after InitializeComponents
. That happens way before the form is shown.
Design your tabs contents as usercontrols. On the main form, each tab only contains a single control. If you want load-on-demand, then make tabs empty in the designer, and put the corresponding usercontrol in the tab when it's first shown.
精彩评论