Bloom.Edit.ThumbNailList._listView_MouseMove C# (CSharp) Метод

_listView_MouseMove() приватный Метод

private _listView_MouseMove ( object sender, MouseEventArgs e ) : void
sender object
e MouseEventArgs
Результат void
        private void _listView_MouseMove(object sender, MouseEventArgs e)
        {
            if (_listView.GetItemAt(e.X, e.Y) == _currentDraggingItem)
                return; //not really a "move" if we're still pointing at the original item

            if (this.RelocatePageEvent != null && _currentDraggingItem != null)
            {
                if (Control.MouseButtons != MouseButtons.Left)
                {
            //hack trying to get a correct notion of when the mouse is up
                    _listView_MouseUp(null, e);
                    return;
                }

                Debug.WriteLine("Dragging");
                Cursor = Cursors.Hand;
                ListViewItem  target=null;
                if (null == _listView.GetItemAt(e.X, e.Y))
                {
                    target = _listView.GetItemAt(e.X+20, e.Y);
                }
                else
                {
                    target = _listView.GetItemAt(e.X, e.Y);
                }

                if (target == null)
                {
                    //when we point right in the middle, we'll get a null target, but we sure want one,
                    //so try looking to one side

                    Debug.WriteLine("null target");
                }
                else
                {
                    Debug.WriteLine("target: " + target.Text);

                    //if we're pointing to the right of some item, we want to insert *after* it.
                    var middle = target.Position.X + (_thumbnailImageList.ImageSize.Width/2);
                    if (e.X > middle && _listView.Items.Count - 1 > target.Index)
                    {
                        target = _listView.Items[target.Index + 1]; //choose the next item
                    }
                }
                if (_currentDraggingItem == target)//doesn't count to drag on yourself
                {
                    return;
                }

                if (target != _currentTarget)
                {
                    _listView.Invalidate(); //repaint
                }
                _currentTarget = target;
            }
        }