Exemple #1
0
        public void SetRowSpan(object control, int value)
        {
            if (value < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(value), string.Format(SR.InvalidArgument, "RowSpan", (value).ToString(CultureInfo.CurrentCulture)));
            }
            if (control == null)
            {
                throw new ArgumentNullException(nameof(control));
            }

            if (IsStub)
            {
                _stub.SetRowSpan(control, value);
            }
            else
            {
                IArrangedElement element = LayoutEngine.CastToArrangedElement(control);
                // LayoutInfo.SetColumnSpan() throws ArgumentException if out of range.
                if (element.Container != null)
                {
                    TableLayout.ClearCachedAssignments(TableLayout.GetContainerInfo(element.Container));
                }
                TableLayout.GetLayoutInfo(element).RowSpan = value;
                LayoutTransaction.DoLayout(element.Container, element, PropertyNames.RowSpan);
                Debug.Assert(GetRowSpan(element) == value, "row span should equal to the value we set");
            }
        }
Exemple #2
0
 private void SetCellPosition(object control, int row, int column, bool rowSpecified, bool colSpecified)
 {
     if (IsStub)
     {
         if (colSpecified)
         {
             _stub.SetColumn(control, column);
         }
         if (rowSpecified)
         {
             _stub.SetRow(control, row);
         }
     }
     else
     {
         IArrangedElement element = LayoutEngine.CastToArrangedElement(control);
         if (element.Container != null)
         {
             TableLayout.ClearCachedAssignments(TableLayout.GetContainerInfo(element.Container));
         }
         TableLayout.LayoutInfo layoutInfo = TableLayout.GetLayoutInfo(element);
         if (colSpecified)
         {
             layoutInfo.ColumnPosition = column;
         }
         if (rowSpecified)
         {
             layoutInfo.RowPosition = row;
         }
         LayoutTransaction.DoLayout(element.Container, element, PropertyNames.TableIndex);
         Debug.Assert(!colSpecified || GetColumn(element) == column, "column position shoule equal to what we set");
         Debug.Assert(!rowSpecified || GetRow(element) == row, "row position shoule equal to what we set");
     }
 }
Exemple #3
0
        public void SetRowSpan(object control, int value)
        {
            ArgumentNullException.ThrowIfNull(control);

            if (value < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(value), value, string.Format(SR.InvalidArgument, nameof(value), value));
            }

            if (IsStub)
            {
                _stub.SetRowSpan(control, value);
            }
            else
            {
                IArrangedElement element = LayoutEngine.CastToArrangedElement(control);
                if (element.Container is not null)
                {
                    TableLayout.ClearCachedAssignments(TableLayout.GetContainerInfo(element.Container));
                }

                TableLayout.GetLayoutInfo(element).RowSpan = value;
                LayoutTransaction.DoLayout(element.Container, element, PropertyNames.RowSpan);
                Debug.Assert(GetRowSpan(element) == value, "row span should equal to the value we set");
            }
        }