Пример #1
0
        private void slot_MouseMove(object sender, MouseEventArgs e)
        {
            var p = Cursor.Position;

            if (lastMoveSlot != p)
            {
                lastMoveSlot = p;

                if (slotMouseDown && ((ActionSlot)sender).Type != SlotType.None && ((ActionSlot)sender).Type != SlotType.FolderBack)
                {
                    isDrag       = true;
                    borderedSlot = null;
                    Invalidate(true);

                    Point  ptStart = this.PointToScreen(new Point(e.X, e.Y));
                    int    relX    = ptStart.X - this.Location.X;
                    int    relY    = ptStart.Y - this.Location.Y;
                    Bitmap bm      = CursorUtil.AsBitmapWithCursor((ActionSlot)sender);
                    if (dragCursor != null)
                    {
                        dragCursor.Dispose();
                    }
                    dragCursor = CursorUtil.CreateCursor((Bitmap)bm, relX + CursorUtil.cursorSize, relY + CursorUtil.cursorSize);

                    startDragSlot = ((ActionSlot)sender);

                    int  id          = GetSlotId((ActionSlot)sender);
                    Slot draggedSlot = Storage.CurProfile.GetPageByPath(Storage.CurPathString()).Slots.Find(s => s.Id == id);
                    this.DoDragDrop((Slot)draggedSlot, DragDropEffects.All);
                    Cursor.Current = dragCursor;
                }
            }
        }
Пример #2
0
        private void action_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                isDrag     = true;
                dragObject = ((Button)sender);
                HideSettings();
                borderedSlot = null;
                Invalidate(true);

                Point  ptStart = this.PointToScreen(new Point(e.X, e.Y));
                int    relX    = ptStart.X - this.Location.X;
                int    relY    = ptStart.Y - this.Location.Y;
                Bitmap bm      = CursorUtil.AsBitmapWithCursor((Button)sender);
                if (dragCursor != null)
                {
                    dragCursor.Dispose();
                }
                dragCursor = CursorUtil.CreateCursor((Bitmap)bm, relX + CursorUtil.cursorSize, relY + CursorUtil.cursorSize);

                this.DoDragDrop(((Action)sender).Type, DragDropEffects.All);
                Cursor.Current = dragCursor;
            }
            else
            {
                isDrag = false;
            }
        }