Exemplo n.º 1
0
 private void _empty_AboutToDrop(ProviderTokenTile sender, ProviderTokenTileDragEventArgs e)
 {
     int index = _flow.Controls.IndexOf(_empty);
     _flow.Controls.Remove(_empty);
     if (index >= 0)
         _items.Insert(index, e.TokenTile.Token.Provider);
     e.Handled = true;
     _internalDrag = false;
 }
Exemplo n.º 2
0
        private void _panel_MouseMove(object sender, MouseEventArgs e)
        {
            OnMouseMove(e);

            Control ctrl = sender as Control;
            if (!_isMouseDown || e.Button != MouseButtons.Left || !AllowDrag || _token == null || ctrl == null)
                return;

            int dX = Math.Abs(e.Location.X - _lastMouseDown.X);
            int dY = Math.Abs(e.Location.Y - _lastMouseDown.Y);
            Point dMax = GetDragThreshold();
            if (dX < dMax.X && dY < dMax.Y)
                return;

            _isMouseDown = false;

            var args = new ProviderTokenTileDragEventArgs()
            {
                TokenTile = this,
                Cancel = false,
                Handled = false,
                Location = ctrl.PointToScreen(e.Location)
            };
            AboutToDrag(this, args);
            if (!args.Cancel)
            {
                Debug.WriteLine(this.Name + " start drag");
                this.DoDragDrop(args, DragDropEffects.Copy);
            }
        }
Exemplo n.º 3
0
        private void tile_AboutToDrag(ProviderTokenTile sender, ProviderTokenTileDragEventArgs e)
        {
            if (!AllowItemDrag)
                return;

            sender.QueryContinueDrag += new QueryContinueDragEventHandler(tile_QueryContinueDrag);
            _internalDrag = true;
            if (AllowDragArrange)
            {
                int index = _flow.Controls.IndexOf(sender);
                _items.RemoveAt(index);
                _flow.Controls.Add(_empty);
                _flow.Controls.SetChildIndex(_empty, index);
                _flow.Controls.Remove(sender);
            }
        }