private void tabControl1_SelectedIndexChanged(object sender, EventArgs e) { if (tabControl1.SelectedIndex != -1) { if (!_muteEvents) { _areaMapComponent.SetIndex(tabControl1.SelectedIndex); } _areaMapComponent.Parent.Controls.Remove(_areaMapComponent); tabControl1.SelectedTab.Controls.Add(_areaMapComponent); _areaMapComponent.Dock = DockStyle.Fill; } }