Example #1
0
        /// <summary>
        /// Begin button drag
        /// </summary>
        /// <param name="selected">selected button</param>
        /// <param name="mousePosition">mouse position</param>
        /// <param name="cursor">cursor</param>
        /// <returns>true if button drag is started</returns>
        protected override bool BeginButtonDrag(UnitButton selected, Point mousePosition, ref Cursor cursor)
        {
            if (CanMoveByMouse == false)
            {
                return(true);
            }

            EventHandler <FormEventArgs> handler = UndockForm;

            if (handler != null)
            {
                _movedButton = selected;
                _movedForm   = (Form)_movedButton.Page;
                _movedIndex  = SelectedIndex;

                Point         mouseScreenPosition = Control.MousePosition;
                FormEventArgs args = new FormEventArgs(_movedForm, GetPageInfo(_movedForm).Id);
                handler(this, args);

                RemoveButton(_movedButton);

                _movedDecorator = HierarchyUtility.GetFormsDecorator(_movedForm);

                IsFocused = false;
                _movedDecorator.IsFocused = true;

                _movedDecorator.BeginMovementByMouse(mouseScreenPosition);

                cursor = Cursors.SizeAll;
            }

            return(true);
        }
Example #2
0
 /// <summary>
 /// End button drag
 /// </summary>
 /// <param name="cancel">cancel</param>
 protected override void EndButtonDrag(bool cancel)
 {
     if (cancel)
     {
         InsertButton(_movedButton, _movedIndex);
     }
     else if (_movedDecorator != null)
     {
         _movedDecorator.EndMovementByMouse();
         _movedDecorator = null;
     }
 }