void TabLabel_MouseMove(object sender, MouseEventArgs e) { if (_tempMouse != null) { Rectangle move = new Rectangle( _tempMouse.Value.X - SystemInformation.DragSize.Width / 2, _tempMouse.Value.Y - SystemInformation.DragSize.Height / 2, SystemInformation.DragSize.Width, SystemInformation.DragSize.Height ); if (!move.Contains(TabPanel.PointToClient(e.Location))) { TabPanel.DoDragDrop(sender, DragDropEffects.All); _tempMouse = null; } } }