예제 #1
0
        private void GetDragState(ref bool AIsDragTarget, ref Point ADragLocation, DragEventArgs AArgs)
        {
            ObjectDesignerData LData = AArgs.Data as ObjectDesignerData;

            if (LData != null)
            {
                ObjectSchema LObject = (ObjectSchema)FGrid
                                       [
                    ClientToGrid(PointToClient(new Point(AArgs.X, AArgs.Y)))
                                       ];
                if (LObject == null)
                {
                    ADragLocation = ClientToGrid(PointToClient(new Point(AArgs.X, AArgs.Y)));
                    AIsDragTarget = true;
                }
            }
        }
예제 #2
0
        protected override void OnDragDrop(DragEventArgs AArgs)
        {
            base.OnDragDrop(AArgs);

            SetDragState(false, Point.Empty);

            bool  LIsDragTarget = false;
            Point LDragLocation = Point.Empty;

            GetDragState(ref LIsDragTarget, ref LDragLocation, AArgs);
            if (LIsDragTarget)
            {
                ObjectDesignerData LData = AArgs.Data as ObjectDesignerData;
                if (LData != null)
                {
                    FGrid[FGrid.GetPosition(LData.Object)] = null;
                    FGrid[LDragLocation] = LData.Object;
                    UpdateRange();
                    UpdateDisplay(true);
                    UpdateScrollBars();
                    PerformLayout();
                }
            }
        }