/// <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(TabButton 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);
        }
Esempio n. 2
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(TabButton selected, Point mousePosition, ref Cursor cursor)
        {
            EventHandler<FormEventArgs> handler = UndockForm;
             if (handler != null)
             {
            _movedButton   = selected;
            _movedForm     = (Form)_movedButton.Page;
            _movedIndex    = SelectedIndex;

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

            RemoveButton(_movedButton);

            _movedDecorator = HierarchyUtility.GetFormsDecorator(_movedForm);
            _movedDecorator.BeginMovementByMouse(mouseScreenPosition);

            cursor = Cursors.SizeAll;
             }

             return true;
        }