Пример #1
0
            private bool RestoreSelectedIndex(ToolStripItem[] newMenuItems)
            {
                if (!_selectedIndex.HasValue) return false;
                if (!newMenuItems.Any()) return false;
                if (_selectedIndex < 0) return false;

                if (_selectedIndex < newMenuItems.Length)
                {
                    newMenuItems[_selectedIndex.Value].Select();
                }
                else
                {
                    newMenuItems.Last().Select();
                }

                return true;
            }