Exemplo n.º 1
0
        /// <summary>
        /// Creates a floating form of a specified <c ref="CommandBarStripElement"/>.
        /// </summary>
        /// <param name="stripElement">The strip element of which the floating form should be created.</param>
        /// <param name="currentRow">The <c ref="CommandBarRowElement"/> that contains the strip element.</param>
        /// <param name="initialLocation">The initial location of the floating form.</param>
        public void CreateFloatingStrip(CommandBarStripElement stripElement, CommandBarRowElement currentRow, Point initialLocation)
        {
            if (!stripElement.EnableFloating || this.OnFloatingStripCreating(stripElement))
            {
                return;
            }

            CommandBarFloatingForm floatingForm = new CommandBarFloatingForm();

            floatingForm.ParentControl = this.ElementTree.Control.Parent;
            Point initialDragOffset = Point.Empty;

            if (!this.RightToLeft)
            {
                floatingForm.RightToLeft = System.Windows.Forms.RightToLeft.No;
                floatingForm.Location    = Point.Add(initialLocation, new Size(-5, -5));
                initialDragOffset        = new Point(5, 5);
            }
            else
            {
                floatingForm.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
                floatingForm.Location    = Point.Add(Point.Add(initialLocation, new Size(-stripElement.Size.Width, 0)), new Size(5, -5));
                initialDragOffset        = new Point(stripElement.Size.Width - 5, 5);
            }

            floatingForm.Text           = stripElement.Name;
            stripElement.EnableDragging = false;
            stripElement.Capture        = false;
            stripElement.ForceEndDrag();

            Size screenSize = Screen.GetWorkingArea(this.ElementTree.Control).Size;

            stripElement.Orientation = System.Windows.Forms.Orientation.Horizontal;
            floatingForm.ClientSize  = (stripElement.GetExpectedSize(screenSize).ToSize());

            stripElement.FloatingForm = floatingForm;
            floatingForm.StripElement = stripElement;

            if (currentRow != null)
            {
                currentRow.Strips.Remove(stripElement);
            }

            floatingForm.StripInfoHolder.AddStripInfo(stripElement);
            floatingForm.Show();

            this.OnFloatingStripCreated(stripElement);

            floatingForm.InitializeMove(initialDragOffset);
            Cursor.Current = Cursors.SizeAll;

            if (currentRow != null && currentRow.Strips.Count == 0)
            {
                this.Rows.Remove(currentRow);
            }
        }
Exemplo n.º 2
0
        public void CreateFloatingStrip(
            CommandBarStripElement stripElement,
            CommandBarRowElement currentRow,
            Point initialLocation)
        {
            if (!stripElement.EnableFloating || this.OnFloatingStripCreating((object)stripElement))
            {
                return;
            }
            CommandBarFloatingForm commandBarFloatingForm = new CommandBarFloatingForm();

            commandBarFloatingForm.ParentControl = this.ElementTree.Control.Parent;
            Point offset = Point.Empty;

            if (!this.RightToLeft)
            {
                commandBarFloatingForm.RightToLeft = RightToLeft.No;
                commandBarFloatingForm.Location    = Point.Add(initialLocation, new Size(-5, -5));
                offset = new Point(5, 5);
            }
            else
            {
                commandBarFloatingForm.RightToLeft = RightToLeft.Yes;
                commandBarFloatingForm.Location    = Point.Add(Point.Add(initialLocation, new Size(-stripElement.Size.Width, 0)), new Size(5, -5));
                offset = new Point(stripElement.Size.Width - 5, 5);
            }
            commandBarFloatingForm.Text = stripElement.DisplayName;
            stripElement.EnableDragging = false;
            stripElement.Capture        = false;
            stripElement.ForceEndDrag();
            Size size = Screen.GetWorkingArea(this.ElementTree.Control).Size;

            stripElement.Orientation            = Orientation.Horizontal;
            commandBarFloatingForm.ClientSize   = stripElement.GetExpectedSize((SizeF)size).ToSize();
            stripElement.FloatingForm           = commandBarFloatingForm;
            commandBarFloatingForm.StripElement = stripElement;
            currentRow?.Strips.Remove((RadItem)stripElement);
            commandBarFloatingForm.StripInfoHolder.AddStripInfo(stripElement);
            commandBarFloatingForm.Show();
            this.OnFloatingStripCreated((object)stripElement);
            commandBarFloatingForm.InitializeMove(offset);
            Cursor.Current = Cursors.SizeAll;
            if (currentRow == null || currentRow.Strips.Count != 0)
            {
                return;
            }
            this.Rows.Remove((RadItem)currentRow);
        }