protected override void OnDragDrop(DragEventArgs e) { base.OnDragDrop(e); if (e.Data.GetDataPresent(typeof(ATP))) { ATP tb = (ATP)e.Data.GetData(typeof(ATP)); if (tb.Equals(null)) { return; } this.TabPages.Add(tb.Element); this.SelectedTab = tb.Element; highlight = false; // if((tb.Origin as TabControl).TabCount==1) // { // //Trace.WriteLine((tb.Tag as TabControl).Name + " is empty now"); // (tb.Origin as TabControl).Height = 30; // } this.Invalidate(); Refresh(); } }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (e.Button == MouseButtons.Left && Control.ModifierKeys == Keys.Control) { //dragging = true; Point pt = new Point(e.X, e.Y); TabPage tp = GetTabPageByTab(pt) as TabPage; ATP atp = new ATP(); atp.Element = tp; atp.Origin = this; if (tp != null) { DragDropEffects effect = DoDragDrop(atp, DragDropEffects.All); } } }