Exemple #1
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 #2
0
        public int GetColumn(object control)
        {
            ArgumentNullException.ThrowIfNull(control);

            if (IsStub)
            {
                return(_stub.GetColumn(control));
            }
            else
            {
                IArrangedElement       element    = LayoutEngine.CastToArrangedElement(control);
                TableLayout.LayoutInfo layoutInfo = TableLayout.GetLayoutInfo(element);
                return(layoutInfo.ColumnPosition);
            }
        }
Exemple #3
0
 public int GetRow(object control)
 {
     if (control == null)
     {
         throw new ArgumentNullException(nameof(control));
     }
     if (IsStub)
     {
         return(_stub.GetRow(control));
     }
     else
     {
         IArrangedElement       element    = LayoutEngine.CastToArrangedElement(control);
         TableLayout.LayoutInfo layoutInfo = TableLayout.GetLayoutInfo(element);
         return(layoutInfo.RowPosition);
     }
 }