예제 #1
0
        private void LeftResize(MouseEventArgs e)
        {
            if ((e.Location.X > this.ClientRectangle.Left + offsetStep) &&
                (e.Location.X >= this.oldMousePos.X))
            {
                SuspendLayout();

                int width = this.GetPreferredWidthToShrink();

                if (width > 0)
                {
                    if (this.Size.Width - width > this.MinimumSize.Width)
                    {
                        ToolStripFlowLayout layout = (this.Controls[0] as RadToolStripItemControl).ContainerElement.StackLayoutPanel;

                        this.Size     = new Size(this.Size.Width - width, this.Size.Height);
                        this.Location = new Point(this.Location.X + width, this.Location.Y);

                        RadItem bottomMoseItem = this.GetBottomMostItem();

                        this.Size   = new Size(this.Size.Width, this.CaptionHeight + 4 + bottomMoseItem.Bounds.Bottom);
                        offsetPoint = e.Location;
                    }
                }
                ResumeLayout(true);
            }
            else
            {
                this.SuspendLayout();
                if (this.shrinkWidths.Count > 0)
                {
                    // extend
                    int width = this.shrinkWidths.Pop();

                    if (width > 0)
                    {
                        if ((-width - offsetStep > e.Location.X) && (this.PointToScreen(e.Location).X < this.PointToScreen(this.oldMousePos).X))
                        {
                            this.Size     = new Size(this.Size.Width + width, this.Size.Height);
                            this.Location = new Point(this.Location.X - width, this.Location.Y);

                            ToolStripFlowLayout layout = (this.Controls[0] as RadToolStripItemControl).ContainerElement.StackLayoutPanel;

                            RadItem bottomMoseItem = this.GetBottomMostItem();

                            this.Size   = new Size(this.Size.Width, this.CaptionHeight + 4 + bottomMoseItem.Bounds.Bottom);
                            offsetPoint = e.Location;
                        }
                        else
                        {
                            this.shrinkWidths.Push(width);
                        }
                    }

                    this.ResumeLayout(true);
                }
            }

            this.oldMousePos = new Point(e.X, e.Y);
        }
예제 #2
0
        protected override void CreateChildElements()
        {
            if (this.containerForm == null)
            {
                return;
            }

            this.parentPanel = new ToolStripFlowLayout(containerForm);
            this.parentPanel.AutoSizeMode = RadAutoSizeMode.WrapAroundChildren;

            this.fill          = new FillPrimitive();
            this.fill.AutoSize = false;

            this.Children.Add(fill);

            this.Children.Add(this.parentPanel);
            this.items.Owner = this.parentPanel;

            RefreshItems();
        }
예제 #3
0
        private RadItem GetBottomMostItem()
        {
            ToolStripFlowLayout layout         = (this.Controls[0] as RadToolStripItemControl).ContainerElement.StackLayoutPanel;
            RadItem             bottomMoseItem = null;

            foreach (RadItem myItem in layout.Children)
            {
                if (bottomMoseItem == null)
                {
                    bottomMoseItem = myItem;
                }
                else
                {
                    if (bottomMoseItem.Bounds.Top < myItem.Bounds.Top)
                    {
                        bottomMoseItem = myItem;
                    }
                }
            }

            return(bottomMoseItem);
        }