/// <summary> /// Adds a control to the grid layout /// </summary> /// <param name="control">the control to add</param> /// <typeparam name="T">the type of control to add</typeparam> /// <param name="column">the column in which the control will be placed</param> /// <param name="row">thhe row in which the control will be placed</param> /// <param name="columnSpan">the number of columns this control should cover</param> /// <param name="rowSpan">the number of rows this control should cover</param> /// <returns>the control you added</returns> public T Add <T>(T control, int column, int row, int columnSpan = 1, int rowSpan = 1) where T : ConsoleControl { var assignment = new GridLayoutAssignment() { Control = control, Column = column, Row = row, ColumnSpan = columnSpan, RowSpan = rowSpan }; layoutAssignments.Add(assignment); control.Bounds = GetCellArea(assignment); ProtectedPanel.Controls.Add(control); return(control); }
/// <summary> /// Adds a control to the grid layout /// </summary> /// <param name="control">the control to add</param> /// <typeparam name="T">the type of control to add</typeparam> /// <param name="column">the column in which the control will be placed</param> /// <param name="row">thhe row in which the control will be placed</param> /// <param name="columnSpan">the number of columns this control should cover</param> /// <param name="rowSpan">the number of rows this control should cover</param> /// <returns>the control you added</returns> public T Add <T>(T control, int column, int row, int columnSpan = 1, int rowSpan = 1) where T : ConsoleControl { var assignment = new GridLayoutAssignment() { Control = control, Column = column, Row = row, ColumnSpan = columnSpan, RowSpan = rowSpan }; layoutAssignments.Add(assignment); control.Bounds = GetCellArea(assignment); using (var modifyLock = Unlock()) { Controls.Add(control); } return(control); }
private RectF GetCellArea(GridLayoutAssignment assignment) { return(GetCellArea(assignment.Column, assignment.Row, assignment.ColumnSpan, assignment.RowSpan)); }