示例#1
0
        /// <summary>
        /// Moves the selected container to the container that is below the mouse (ignoreing the selected container)
        /// </summary>
        public void MoveSelectedToBelow()
        {
            if (SelectedContainer != null)
            {
                // get the new container of the selected container
                BaseContainer newContainer = FindContainerAtPoint(MousePosition, SelectedContainer);

                if (newContainer is PlaceHolder)
                {
                    newContainer = newContainer.ParentContainer;
                    if (newContainer is Container)
                    {
                        Container container = (Container)newContainer;
                        if (container.RenderMode == ContainerRenderMode.Linear)
                        {
                            RemoveChild(SelectedContainer);
                            PlaceHolder.ReplaceWith(SelectedContainer);
                            SelectedContainer.Location = PlaceHolder.Location;
                            RemovePlaceHolder();
                            return;
                        }
                    }
                }

                // update the location of the selected
                Point selectedScreen = SelectedContainer.PointToScreen(Point.Empty);
                Point difference     = newContainer.PointToClient(selectedScreen);
                SelectedContainer.Location = difference;

                // move to new
                SelectedContainer.MoveTo(newContainer);
                RemovePlaceHolder();
            }
        }
示例#2
0
 /// <summary>
 /// Moves the selected container to this plan
 /// </summary>
 public void MoveSelectedToThis()
 {
     if (SelectedContainer != null)
     {
         if (SelectedContainer.ParentContainer is Container && ((Container)SelectedContainer.ParentContainer).RenderMode == ContainerRenderMode.Linear)
         {
             PutPlaceHolder(SelectedContainer);
             SelectedContainer.Location   = PointToClient(PlaceHolder.ParentContainer.PointToScreen(SelectedContainer.Location));
             SelectedContainer.ClientSize = PlaceHolder.ClientSize;
             SelectedContainer.Size       = SelectedContainer.ClientSize;
         }
         else
         {
             SelectedContainer.Location = PointToClient(SelectedContainer.ParentContainer.PointToScreen(SelectedContainer.Location));
         }
         SelectedContainer.MoveTo(this);
     }
 }