示例#1
0
        private void EventTab_DragDrop(object sender, DragEventArgs e)
        {
            TaskButton selectedButton = (TaskButton)e.Data.GetData(typeof(TaskButton));
            EventTab   _destination   = (EventTab)sender;
            EventTab   _source        = (EventTab)selectedButton.Parent;

            if (_source != _destination)
            {
                _destination.Controls.Add(selectedButton);
                _destination.tasks.Add(selectedButton.Task);
                _destination.Height += 45;
                int index = _destination.Controls.Count;
                _destination.Controls.SetChildIndex(selectedButton, index - 2);
                _destination.Invalidate();
                _source.Invalidate();
                dragController = true;
            }
            else
            {
                dragController = true;
            }
            _destination.Controls.Remove(dragPanel);
        }