[]
        
(Showing Draft Content)

C1.Win.C1FlexGrid.IC1FlexGridRowDetail.UpdateSize

UpdateSize Method

UpdateSize(C1FlexGrid, int, Size)

Used to update size of the control.

Declaration
void UpdateSize(C1FlexGrid parentGrid, int rowIndex, Size proposedSize)
Parameters
Type Name Description
C1FlexGrid parentGrid

FlexGrid which displays detail control.

int rowIndex

Index of parent detail row.

Size proposedSize

The proposed size for the detail control.

Remarks

The detail control should update its size in this method.

Height of the detail row will be adjusted based on the height of the control.

The easiest way to update size is to assign value of proposedSize parameter. The width of proposed size is the width of all cells from first non-fixed to last. The height of proposed size is the current height of the control.

Examples

The code below shows the implementation of UpdateSize method using proposedSize parameter:

void IC1FlexGridRowDetail.UpdateSize(C1FlexGrid parentGrid, int rowIndex, Size proposedSize)
{ 
    // assign proposedSize as control's size
    Size = proposedSize; 
}

The code below shows the basic implementation of UpdateSize method for detail control derived from C1Label:

void IC1FlexGridRowDetail.UpdateSize(C1FlexGrid parentGrid, int rowIndex, Size proposedSize)
{ 
    // accuire size of partent grid's scrollable area
    var srSz = parentGrid.ScrollableRectangle.Size; 

    // measure the size of C1Label's text, which fits into parent's grid scrollable area width
    var sz = TextRenderer.MeasureText(Text, Font, srSz, TextFormatFlags.WordBreak);

    // chose the maximum width between scrollable area and measured text
    sz.Width = Math.Max(sz.Width, srSz.Width); 

    // assign calculated size as control's size
    Size = sz;
}