示例#1
0
 private void TabControl_DraggedOut(object sender, TabDragEventArgs e)
 {
     Browser temp = browserControl.PopBrowser(e.TabIndex);
     BrowserForm browserForm = new BrowserForm(temp);
     browserForm.Show();
     ((BrowserForm)temp.FindForm()).FormFollowMouse();
     temp.QueryContinueDrag += Browser_QueryContinueDrag;
     temp.DoDragDrop(temp, DragDropEffects.Copy);
 }
示例#2
0
        private void Tab_QueryContinueDrag(object sender, QueryContinueDragEventArgs e)
        {
            if (tabs.Count == 1) return;
            int left = this.PointToScreen(this.Location).X;
            int right = left + this.Size.Width;
            int top = this.PointToScreen(this.Location).Y;
            int bottom = top + this.Size.Height;
            Point mousePoint = Control.MousePosition;

            if (left > mousePoint.X //dragged out
                || mousePoint.X > right
                || top > mousePoint.Y
                || mousePoint.Y > bottom)
            {
                TabButton tab = (TabButton)sender;
                int index = tabs.IndexOf(tab);
                TabDragEventArgs dragEvent = new TabDragEventArgs(mousePoint.X, mousePoint.Y, index); // drag info

                RemoveTab(tab);

                TabRefresh();

                tab.QueryContinueDrag -= Tab_QueryContinueDrag;
                e.Action = DragAction.Cancel;
                OnTabDraggedOut(sender, dragEvent);
            }
        }