예제 #1
0
        void ISectionHost.DoDragDropOperation( Section sectionToDrag )
        {
            _draggingSections = sectionToDrag.GetExpandedDragList();
            object[] data = sectionToDrag.GetDragObjects();

            _imageWindowOffX = sectionToDrag.HostBasedRectangle.X - CursorClientPosition.X;
            _imageWindowOffY = sectionToDrag.HostBasedRectangle.Y - CursorClientPosition.Y;

            _imageWindow = CreateDragImageWindow( _draggingSections, data.Length != _draggingSections.Length );

            if( DoDragDrop( data, DragDropEffects.Copy | DragDropEffects.Move ) == DragDropEffects.None )
            {
                Point cursorPos = PointToClient( Cursor.Position );
                if( _lastDragAction == DragAction.Drop )
                {
                    Rectangle rc = Rectangle.Empty;
                    foreach( Section s in _draggingSections )
                    {
                        if( rc == Rectangle.Empty )
                        {
                            rc = s.HostBasedRectangle;
                        }
                        else
                        {
                            rc = Rectangle.Union( rc, s.HostBasedRectangle );
                        }
                    }
                    foreach( Section s in _draggingSections )
                    {
                        if( s.CanDropInVoid && !rc.Contains( cursorPos ) )
                        {
                            s.DroppedInVoid();
                        }
                    }
                }
            }
            FinishDropOperation();
        }
예제 #2
0
        private void FinishDropOperation()
        {
            if( _currentDropSection != null )
            {
                _currentDropSection.DragLeave();
                _currentDropSection = null;
            }

            if( _sectionMouseButtonPressed != null )
            {
                _sectionMouseButtonPressed.MouseUp( new MouseEventArgs( MouseButtons.Left, 1, 0, 0, 0 ) );
                _sectionMouseButtonPressed = null;
            }
            _draggingSections = null;
            Cursor = Cursors.Arrow;
            if( _imageWindow != null )
            {
                _imageWindow.Dispose();
                _imageWindow = null;
            }
            _currentDropSection = null;
        }
 public void Dispose()
 {
     if( !_disposed )
     {
         if( --_referencesCount == 0 )
         {
             if( _upArrowWindow != null )
             {
                 _upArrowWindow.Close();
                 _upArrowWindow = null;
             }
             if( _downArrowWindow != null )
             {
                 _downArrowWindow.Close();
                 _downArrowWindow = null;
             }
         }
         Debug.Assert( _referencesCount >= 0 );
         _disposed = true;
     }
 }