CGXGridCore::ResizeRowHeightsToFit
virtual BOOL ResizeRowHeightsToFit(CGXRange range, BOOL bResizeCoveredCells = TRUE, UINT nFlags = GX_UPDATENOW);
range
Specifies the range of cells through which ResizeRowHeightsToFit will loop to find the optimal height for the affected rows.
bResizeCoveredCells
TRUE if covered cells which span several rows shall be resized, FALSE if covered cells shall be ignored.
nFlags
Specifies the update technique and some advanced options:
- GX_UPDATENOW specifies to update the window after each row-height change.
- GX_INVALIDATE simply invalidates the window area to the right of the first row that is resized.
- GX_NOSHRINKSIZE specifies that the row-height should not become smaller. Rows shall only be enlarged.
Return Value
TRUE if command succeeded; FALSE if command failed or user aborted the operation.
If you do a series of commands, you should check the return value and abort your operation (or rollback the transaction) if the return value is FALSE.
Remarks
Call this command to automatically resize the row-heights for a given range of cells.
ResizeRowHeightsToFit will loop through each cell in the range and call the associated control’s CalcSize method to determine the optimal height for the cell. For each row, ResizeRowHeightsToFit calculates the maximal height from the individual cells.
If there is a covered cell and the specified range includes all rows spanned by the covered cell, and bResizeCoveredCells is TRUE, ResizeRowHeightsToFit will resize the last row of the covered cell.
The user can abort the operation.
All SetRowHeight commands are packed in a transaction (BeginTrans, CommitTrans block). Therefore, the user can undo all changes with one undo-command.
Control-Factory Specific ->
This method has been implemented using the abstraction mechanism as discussed in the chapter "Reducing the size of your application" in the user's guide. A call to the ImplementResizeToFit method from within the control factory class' InitializeGridComponents method will make the concrete implementation of this method available to your application.
If no concrete implementation is available this method returns FALSE. A warning will be displayed in the debug window.
END Control-Factory Specific
Example
The first example resizes rows 5 to 7.
ResizeRowHeightsToFit(CGXRange( ).SetRows(5, 7));
The next example resizes the row of the current cell.
ROWCOL nRow, nCol;
if (GetCurrentCell(nRow, nCol))
ResizeRowHeightsToFit(CGXRange(nRow, nCol));
See Also
CGXControl::CalcSize CGXGridCore::SetRowHeight