Ejemplo n.º 1
0
        /// <summary>
        /// Set the tab scheme to use on a given control
        /// </summary>
        /// <param name="c"></param>
        /// <returns></returns>
        public void SetTabControlComparerType(Control control, TabControlComparerType commparerType)
        {
            if (commparerType == TabControlComparerType.None)
            {
                _extendees.Remove(control);

                // If we no longer have any extendees, we don't need to be wired up to the form load event.
                if (_extendees.Count == 0)
                {
                    UnhookFormLoad();
                }

                return;
            }

            _extendees[control] = commparerType;
            if (_topLevelForm != null) return;

            if (control.TopLevelControl != null)
            {
                // We're in luck.
                // This is the form, or this control knows about it, so take the opportunity to grab it and wire up to its Load event.
                _topLevelForm = control.TopLevelControl as Form;
                HookFormLoad();
            }
            else
            {
                // Set up to wait around until this control or one of its ancestors is added to the form's control hierarchy.
                HookParentChangedEvents(control);
            }
        }
Ejemplo n.º 2
0
 private static TabControlComparer GetTabControlComparerFromType(TabControlComparerType tabControlComparerType)
 {
     switch (tabControlComparerType)
     {
         case TabControlComparerType.None:
             return TabControlComparer.None;
         case TabControlComparerType.AcrossFirst:
             return TabControlComparer.AcrossFirst;
         case TabControlComparerType.DownFirst:
             return TabControlComparer.DownFirst;
         default:
             return TabControlComparer.None;
     }
 }