<< Return to Main Index

< Return to Class Index

CGXWrappedGrid::ResizeWGRowHeightsToFit

virtual BOOL ResizeWGRowHeightsToFit(CGXRange& range, UINT nFlags = GX_UPDATENOW);

range

Specifies the range of cells through which ResizeWGRowHeightsToFit will loop to find the optimal width for the affected columns.

nFlags

Specifies the update technique.

GX_UPDATENOW specifies to update the window after each row-height change.

GX

INVALIDATE simply invalidates the window area to the bottom 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 the command was successful; FALSE if it failed.

Remarks

Call this command to automatically resize the row-heights for a given range of logical cells.

ResizeWGRowHeightsToFit will loop through each logical cell in the range and call the associated control’s CalcSize method to determine the optimal width for the cell. For each logical row, ResizeWGRowHeightToFit calculates the maximal width from the individual logical cells.

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.

Example

The first example resizes logical rows 2 to 5:

ResizeWGRowHeightsToFit(CGXRange().SetRows(2,5));

The next example resizes the row of the current cell.

ROWCOL nAbsRow, nAbsCol;
if(GetCurrentCell(nAbsRow, nAbsCol))
{
   ROWCOL nLogRow, nLogCol;
   GetLogCellFromAbsCell(nAbsRow, nAbsCol, nLogRow, nLogCol);
   if(nLogCol != GX_INVALID)
      ResizeWGRowHeightsToFit(CGXRange(nLogRow, nLogCol));

}

See Also

CGXWrappedGrid::ResizeWGColWidthsToFit

CGXWrappedGrid

Class Overview | Class Members