Exemple #1
0
        private System.Windows.Forms.FlowDirection RTLTranslateFlowDirection(System.Windows.Forms.FlowDirection direction)
        {
            if (this.Control.RightToLeft != RightToLeft.No)
            {
                switch (direction)
                {
                case System.Windows.Forms.FlowDirection.LeftToRight:
                    return(System.Windows.Forms.FlowDirection.RightToLeft);

                case System.Windows.Forms.FlowDirection.TopDown:
                case System.Windows.Forms.FlowDirection.BottomUp:
                    return(direction);

                case System.Windows.Forms.FlowDirection.RightToLeft:
                    return(System.Windows.Forms.FlowDirection.LeftToRight);
                }
            }
            return(direction);
        }
Exemple #2
0
        private void CreateMarginBoundsList()
        {
            this.commonSizes.Clear();
            if (this.Control.Controls.Count == 0)
            {
                this.childInfo = new ChildInfo[0];
            }
            else
            {
                this.childInfo = new ChildInfo[this.Control.Controls.Count];
                Point point = this.Control.PointToScreen(Point.Empty);
                System.Windows.Forms.FlowDirection direction = this.RTLTranslateFlowDirection(this.Control.FlowDirection);
                bool horizontalFlow = this.HorizontalFlow;
                int  x    = 0x7fffffff;
                int  y    = -1;
                int  num3 = -1;
                if ((horizontalFlow && (direction == System.Windows.Forms.FlowDirection.RightToLeft)) || (!horizontalFlow && (direction == System.Windows.Forms.FlowDirection.BottomUp)))
                {
                    num3 = 0x7fffffff;
                }
                int  index = 0;
                bool flag2 = this.Control.RightToLeft == RightToLeft.Yes;
                index = 0;
                while (index < this.Control.Controls.Count)
                {
                    System.Windows.Forms.Control control = this.Control.Controls[index];
                    Rectangle marginBounds = this.GetMarginBounds(control);
                    Rectangle bounds       = control.Bounds;
                    if (horizontalFlow)
                    {
                        bounds.X     -= !flag2 ? control.Margin.Left : control.Margin.Right;
                        bounds.Width += control.Margin.Horizontal;
                        bounds.Height--;
                    }
                    else
                    {
                        bounds.Y      -= control.Margin.Top;
                        bounds.Height += control.Margin.Vertical;
                        bounds.Width--;
                    }
                    marginBounds.Offset(point.X, point.Y);
                    bounds.Offset(point.X, point.Y);
                    this.childInfo[index].marginBounds    = marginBounds;
                    this.childInfo[index].controlBounds   = bounds;
                    this.childInfo[index].inSelectionColl = false;
                    if ((this.dragControls != null) && this.dragControls.Contains(control))
                    {
                        this.childInfo[index].inSelectionColl = true;
                    }
                    if (horizontalFlow)
                    {
                        if ((((direction == System.Windows.Forms.FlowDirection.LeftToRight) ? (marginBounds.X < num3) : (marginBounds.X > num3)) && (x > 0)) && (y > 0))
                        {
                            this.commonSizes.Add(new Rectangle(x, y, y - x, index));
                            x = 0x7fffffff;
                            y = -1;
                        }
                        num3 = marginBounds.X;
                        if (marginBounds.Top < x)
                        {
                            x = marginBounds.Top;
                        }
                        if (marginBounds.Bottom > y)
                        {
                            y = marginBounds.Bottom;
                        }
                    }
                    else
                    {
                        if ((((direction == System.Windows.Forms.FlowDirection.TopDown) ? (marginBounds.Y < num3) : (marginBounds.Y > num3)) && (x > 0)) && (y > 0))
                        {
                            this.commonSizes.Add(new Rectangle(x, y, y - x, index));
                            x = 0x7fffffff;
                            y = -1;
                        }
                        num3 = marginBounds.Y;
                        if (marginBounds.Left < x)
                        {
                            x = marginBounds.Left;
                        }
                        if (marginBounds.Right > y)
                        {
                            y = marginBounds.Right;
                        }
                    }
                    index++;
                }
                if ((x > 0) && (y > 0))
                {
                    this.commonSizes.Add(new Rectangle(x, y, y - x, index));
                }
                int num5 = 0;
                for (index = 0; index < this.commonSizes.Count; index++)
                {
                    Rectangle rectangle7;
Label_043B:
                    rectangle7 = (Rectangle)this.commonSizes[index];
                    if (num5 < rectangle7.Height)
                    {
                        if (horizontalFlow)
                        {
                            Rectangle rectangle3 = (Rectangle)this.commonSizes[index];
                            this.childInfo[num5].marginBounds.Y = rectangle3.X;
                            Rectangle rectangle4 = (Rectangle)this.commonSizes[index];
                            this.childInfo[num5].marginBounds.Height = rectangle4.Width;
                        }
                        else
                        {
                            Rectangle rectangle5 = (Rectangle)this.commonSizes[index];
                            this.childInfo[num5].marginBounds.X = rectangle5.X;
                            Rectangle rectangle6 = (Rectangle)this.commonSizes[index];
                            this.childInfo[num5].marginBounds.Width = rectangle6.Width;
                        }
                        num5++;
                        goto Label_043B;
                    }
                }
            }
        }