Ejemplo n.º 1
0
        public override void CalculateMinimumSize(LayoutVariables vars)
        {
            LabelCIO        labelCIO = (LabelCIO)_CIOs[LABEL_INDEX];
            ControlBasedCIO stateCIO = (ControlBasedCIO)_CIOs[COMPONENT_INDEX];

            System.Drawing.Size cioSize = stateCIO.GetMinimumSize();

            if (_parent.IsVertical())
            {
                _minSize = cioSize;

                if (labelCIO != null)
                {
                    labelCIO.UseMinimumLabel();
                    System.Drawing.Size labelSize = labelCIO.GetMinimumSize();

                    _minSize.Height += labelSize.Height + vars.RowPadding;
                    _minSize.Width   = Math.Max(_minSize.Width, labelSize.Width);
                }
            }
            else
            {
                _minSize.Height = cioSize.Height;
                _minSize.Width  = vars.RowPadding +
                                  (int)Math.Ceiling(cioSize.Width / (1.0 - vars.OneColLabelPcnt));

                if (labelCIO != null)
                {
                    _minSize.Height = Math.Max(_minSize.Height, labelCIO.GetMinimumSize().Height);
                }
            }
        }
Ejemplo n.º 2
0
        public override void CalculateMinimumSize(LayoutVariables vars)
        {
            ControlBasedCIO stateCIO = (ControlBasedCIO)_CIOs[COMPONENT_INDEX];

            this.MinimumSize = stateCIO.GetMinimumSize();
        }
Ejemplo n.º 3
0
        public override void DoLayout(ContainerCIO container, LayoutVariables vars)
        {
            LabelCIO        labelCIO = (LabelCIO)_CIOs[LABEL_INDEX];
            ControlBasedCIO stateCIO = (ControlBasedCIO)_CIOs[COMPONENT_INDEX];

            System.Windows.Forms.Label label = null;
            Control control = stateCIO.GetControl();
            int     topY    = 0;

            if (_parent.IsVertical())
            {
                if (labelCIO != null)
                {
                    labelCIO.UseMinimumLabel();
                    label = (Label)labelCIO.GetControl();
                    labelCIO.SetAlignment(System.Drawing.ContentAlignment.TopCenter);
                    label.Size     = new System.Drawing.Size(_bounds.Width, labelCIO.GetMinimumSize().Height);
                    label.Location = new System.Drawing.Point(_bounds.X, _bounds.Y);
                    labelCIO.SetLabelText();

                    topY = label.Size.Height + vars.RowPadding;
                }

                if (stateCIO is LabelLinkedCIO)
                {
                    ((Label)control).TextAlign = System.Drawing.ContentAlignment.TopCenter;
                }

                int[] size = LayoutAlgorithms.AllocateSizeValues(
                    _bounds.Height - topY,
                    new int[1] {
                    stateCIO.GetMinimumSize().Height
                },
                    new int[1] {
                    stateCIO.GetPreferredSize().Height
                },
                    vars.RowPadding);

                control.Size     = new System.Drawing.Size(_bounds.Width, size[0]);
                control.Location = new System.Drawing.Point(_bounds.X, _bounds.Y + topY);
            }
            else
            {
                int labelWidth = (int)Math.Round(vars.OneColLabelPcnt * (_bounds.Width - vars.RowPadding));
                int compWidth  = _bounds.Width - labelWidth - vars.RowPadding;

                int[] textOffsets =
                    LayoutAlgorithms.GetTextHeightOffsets(LayoutAlgorithms.GetArrayFromArrayList(_CIOs));

                control.Size     = new System.Drawing.Size(compWidth, _bounds.Height);
                control.Location = new System.Drawing.Point(_bounds.X + labelWidth + vars.RowPadding,
                                                            _bounds.Y + textOffsets[1]);

                if (labelCIO != null)
                {
                    labelCIO.UseMinimumLabel();
                    label           = (Label)labelCIO.GetControl();
                    label.TextAlign = System.Drawing.ContentAlignment.TopRight;
                    label.Size      = new System.Drawing.Size(labelWidth, _bounds.Height - textOffsets[0]);
                    label.Location  = new System.Drawing.Point(_bounds.X, _bounds.Y + textOffsets[0]);
                    labelCIO.SetLabelText();
                }
            }
        }