コード例 #1
0
        public bool ProcessDnD(Control control, object eventSender)
        {
            bool ret = false;

            _currentProceededDragSource.HandleDragStart(eventSender, _lastCreatedDragSourceEventArgs);
            _currentProceededDragSource.HandleDragSetData(eventSender, _lastCreatedDragSourceEventArgs);

            control.GiveFeedback      += HandleGiveFeedback;
            control.QueryContinueDrag += HandleQueryContinueDrag;
            try {
                DragDropEffects effect = control.DoDragDrop(
                    _lastCreatedDragSourceEventArgs.DataObject,
                    _currentProceededDragSource.AllowedEffects
                    );
                _lastCreatedDragSourceEventArgs.Effects = effect;
                ret = effect != DragDropEffects.None;
            } finally {
                control.GiveFeedback      -= HandleGiveFeedback;
                control.QueryContinueDrag -= HandleQueryContinueDrag;
            }
            _currentProceededDragSource.HandleDragFinish(eventSender, _lastCreatedDragSourceEventArgs);

            ClearDnDState();

            return(ret);
        }