In the initial state, I have a program with several tabs using the TabControl container. Can I use the CheckBox'ов group to turn on or turn off certain tabs? CheckBox'ы in a separate GroupBox , in which it will be necessary to select the composition of the heat scheme with a GroupBox (Activity or inactivity of some tabs)
- fourSure you may. The change handler is there, you can change the visible tabs. - nick_n_a
- And how it will look like? Tell me where you can see something like that or can you write it yourself? - Michael K
- 2@Mikhail it seems to me that you need to throw off at least a piece of your implementation so that we can fix it. nobody does anything for anyone on the StackOverFlow resource. You can be explained here, suggest the idea, correct your mistakes. nick_n_a, you have already given a comprehensive answer. Write the logic inside your checkboxes regarding IsChecked.Value. You can describe a kind of controller that will be called inside and knock on each checkbox. - ParanoidPanda
|
1 answer
The difficulty can arise only with the fact that the TabPage class hides its Enabled property. Therefore, before TabPage this property, you can bring an object of the class TabPage to the parent class Control and then access this property. This must be done if there is one TabPage in TabControl . In your case, as far as I understand, there are several tabs, so you can safely use the property, even though it will hide IntelliSense.
You need to hang up on the CheckedChanged event CheckedChanged for each of your CheckBox :
private void CB_CheckedChanged (object sender, EventArgs e) { CheckBox myCB = (CheckBox)sender; if (myCB.CheckState == CheckState.Checked) { tabPage.Enabled = true; } if (myCB.CheckState == CheckState.Unchecked) { tabPage.Enabled = false; } } |