private void OnSourceGalleryMouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left || Control.ModifierKeys != Keys.None || dragItemHitInfo == null)
            {
                return;
            }

            Size      dragSize = SystemInformation.DragSize;
            Rectangle dragRect = new Rectangle(dragItemHitInfo.HitPoint.X - dragSize.Width / 2, dragItemHitInfo.HitPoint.Y - dragSize.Height / 2, dragSize.Width, dragSize.Height);

            if (!(dragRect.Contains(e.Location)))
            {
                sourceGallery.DoDragDrop(dragItemHitInfo.GalleryItem, DragDropEffects.Copy);
            }
        }
Ejemplo n.º 2
0
        private void OnGalleryControlMouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left || Control.ModifierKeys != Keys.None || DragItemHitInfo == null)
            {
                return;
            }
            GalleryControl     gallery      = (GalleryControl)sender;
            List <GalleryItem> checkedItems = gallery.Gallery.GetCheckedItems();

            if (checkedItems.Count == 0)
            {
                checkedItems.Add(DragItemHitInfo.GalleryItem);
            }
            if (!new Rectangle(DragItemHitInfo.HitPoint.X - SystemInformation.DragSize.Width / 2,
                               DragItemHitInfo.HitPoint.Y - SystemInformation.DragSize.Height / 2,
                               SystemInformation.DragSize.Width, SystemInformation.DragSize.Height)
                .Contains(e.Location))
            {
                gallery.DoDragDrop(checkedItems, DragDropEffects.All);
            }
        }