コード例 #1
0
        public void BeginDrag(object data, Rectangle sourceRange, Rectangle moveRange, Point mousePos, GenerateImageCallBack dragImageCreator)
        {
            SourceRange = sourceRange;
            MoveRange   = moveRange;
            DragObject  = data;
            IsDraging   = false;

            if (Owner == null)
            {
                return;
            }

            RelativeMousePos = new Point(sourceRange.X - mousePos.X, sourceRange.Y - mousePos.Y);
            IsDraging        = true;

            if (DraggingFeedback != DragFeedbackType.None)
            {
                if (DragginBox == null)
                {
                    DragginBox = new DragBmpWin(this, DraggingFeedback == DragFeedbackType.SubControl ? Owner : null);
                }
                BuildBmpSource(data, sourceRange, dragImageCreator);
                DragginBox.Show(BmpSource, new Point(sourceRange.X, sourceRange.Y));
            }
        }
コード例 #2
0
        public void BeginDrag(object data, Rectangle sourceRange, Rectangle moveRange, Point mousePos)
        {
            SourceRange = sourceRange;
            MoveRange   = moveRange;
            DragObject  = data;
            IsDraging   = false;

            if (Owner == null)
            {
                return;
            }
            BmpSource        = WinHelper.CopyImage(this.Owner, sourceRange.X, sourceRange.Y, sourceRange.Width, sourceRange.Height);
            RelativeMousePos = new Point(sourceRange.X - mousePos.X, sourceRange.Y - mousePos.Y);
            IsDraging        = true;

            if (DrawBox == null)
            {
                DrawBox = new DragBmpWin();
            }
            DrawBox.Show(BmpSource, new Point(sourceRange.X, sourceRange.Y));
        }