public override void InitializeTab() { base.InitializeTab(); SelectedAreaAddress = AreaUtilities.GetAreaAddress(0); _selectedAreaRadioButtons = new List <RadioButton>(); for (int i = 0; i < 8; i++) { _selectedAreaRadioButtons.Add(splitContainerArea.Panel1.Controls["radioButtonArea" + i] as RadioButton); } for (int i = 0; i < _selectedAreaRadioButtons.Count; i++) { int index = i; _selectedAreaRadioButtons[i].Click += (sender, e) => { checkBoxSelectCurrentArea.Checked = false; SelectedAreaAddress = AreaUtilities.GetAreaAddress(index); }; } }
public AreaManager(Control tabControl, string varFilePath, WatchVariableFlowLayoutPanel watchVariableLayoutPanel) : base(varFilePath, watchVariableLayoutPanel) { _selectedAreaAddress = AreaUtilities.GetAreaAddress(0); SplitContainer splitContainerArea = tabControl.Controls["splitContainerArea"] as SplitContainer; _selectedAreaRadioButtons = new List <RadioButton>(); for (int i = 0; i < 8; i++) { _selectedAreaRadioButtons.Add(splitContainerArea.Panel1.Controls["radioButtonArea" + i] as RadioButton); } _selectCurrentAreaCheckbox = splitContainerArea.Panel1.Controls["checkBoxSelectCurrentArea"] as CheckBox; for (int i = 0; i < _selectedAreaRadioButtons.Count; i++) { int index = i; _selectedAreaRadioButtons[i].Click += (sender, e) => { _selectCurrentAreaCheckbox.Checked = false; _selectedAreaAddress = AreaUtilities.GetAreaAddress(index); }; } }