ComponentOne FlexPivot for WinForms
C1.Win.C1FlexGrid.4.8 Assembly / C1.Win.C1FlexGrid Namespace / IC1FlexGridRowDetail Interface / UpdateSize Method
FlexGrid which displays detail control.
Index of parent detail row.
The proposed size for the detail control.
Example

In This Topic
    UpdateSize Method
    In This Topic
    Used to update size of the control.
    Syntax
    'Declaration
     
    Sub UpdateSize( _
       ByVal parentGrid As C1FlexGrid, _
       ByVal rowIndex As Integer, _
       ByVal proposedSize As Size _
    ) 
    void UpdateSize( 
       C1FlexGrid parentGrid,
       int rowIndex,
       Size proposedSize
    )

    Parameters

    parentGrid
    FlexGrid which displays detail control.
    rowIndex
    Index of parent detail row.
    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.

    Example
    The code below shows the implementation of UpdateSize method using proposedSize parameter: 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)
    { 
        // assign proposedSize as control's size
        Size = proposedSize; 
    }
    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;
    }
    See Also