private ExtendedTabPageDesigner GetSelectedTabPageDesigner()
        {
            ExtendedTabPageDesigner designer    = null;
            ExtendedTabPage         selectedTab = ((ExtendedTabControl)base.Component).SelectedTab;

            if (selectedTab != null)
            {
                IDesignerHost service = (IDesignerHost)this.GetService(typeof(IDesignerHost));
                if (service != null)
                {
                    designer = service.GetDesigner(selectedTab) as ExtendedTabPageDesigner;
                }
            }
            return(designer);
        }
 protected override void OnGiveFeedback(GiveFeedbackEventArgs e)
 {
     if (this.forwardOnDrag)
     {
         ExtendedTabPageDesigner selectedTabPageDesigner = this.GetSelectedTabPageDesigner();
         if (selectedTabPageDesigner != null)
         {
             selectedTabPageDesigner.OnGiveFeedbackInternal(e);
         }
     }
     else
     {
         base.OnGiveFeedback(e);
     }
 }
 protected override void OnDragLeave(EventArgs e)
 {
     if (this.forwardOnDrag)
     {
         ExtendedTabPageDesigner selectedTabPageDesigner = this.GetSelectedTabPageDesigner();
         if (selectedTabPageDesigner != null)
         {
             selectedTabPageDesigner.OnDragLeaveInternal(e);
         }
     }
     else
     {
         base.OnDragLeave(e);
     }
     this.forwardOnDrag = false;
 }
        protected override IComponent[] CreateToolCore(ToolboxItem tool, int x, int y, int width, int height, bool hasLocation, bool hasSize)
        {
            ExtendedTabControl control = (ExtendedTabControl)this.Control;

            if (control.SelectedTab == null)
            {
                throw new ArgumentException("Only ExtendedTabPages can be placed in ExtendedTabControls.");
            }
            IDesignerHost service = (IDesignerHost)this.GetService(typeof(IDesignerHost));

            if (service != null)
            {
                ExtendedTabPageDesigner toInvoke = (ExtendedTabPageDesigner)service.GetDesigner(control.SelectedTab);
                ParentControlDesigner.InvokeCreateTool(toInvoke, tool);
            }
            return(null);
        }
        protected override void OnDragEnter(DragEventArgs de)
        {
            this.forwardOnDrag = false;
            Type   BehaviorDataObjectType = Type.GetType("System.Windows.Forms.Design.Behavior.DropSourceBehavior+BehaviorDataObject");
            object data = null;

            if (BehaviorDataObjectType.IsInstanceOfType(de.Data))
            {
                data = de.Data;
            }
            if (data != null)
            {
                int       primaryControlIndex = -1;
                object[]  arguments           = { -1 };
                ArrayList sortedDragControls  = null;
                sortedDragControls  = (ArrayList)BehaviorDataObjectType.InvokeMember("GetSortedDragControls", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance, null, data, arguments);
                primaryControlIndex = (int)arguments[0];
                if (sortedDragControls != null)
                {
                    for (int i = 0; i < sortedDragControls.Count; i++)
                    {
                        if (!(sortedDragControls[i] is Control) || ((sortedDragControls[i] is Control) && !(sortedDragControls[i] is TabPage)))
                        {
                            this.forwardOnDrag = true;
                            break;
                        }
                    }
                }
            }
            else
            {
                this.forwardOnDrag = true;
            }
            if (this.forwardOnDrag)
            {
                ExtendedTabPageDesigner selectedTabPageDesigner = this.GetSelectedTabPageDesigner();
                if (selectedTabPageDesigner != null)
                {
                    selectedTabPageDesigner.OnDragEnterInternal(de);
                }
            }
            else
            {
                base.OnDragEnter(de);
            }
        }
 protected override void OnDragOver(DragEventArgs de)
 {
     if (this.forwardOnDrag)
     {
         ExtendedTabControl control = (ExtendedTabControl)this.Control;
         Point pt = this.Control.PointToClient(new Point(de.X, de.Y));
         if (!control.DisplayRectangle.Contains(pt))
         {
             de.Effect = DragDropEffects.None;
         }
         else
         {
             ExtendedTabPageDesigner selectedTabPageDesigner = this.GetSelectedTabPageDesigner();
             if (selectedTabPageDesigner != null)
             {
                 selectedTabPageDesigner.OnDragOverInternal(de);
             }
         }
     }
     else
     {
         base.OnDragOver(de);
     }
 }