C1FlexGrid AutoSizeRows results in clipped text

Posted by: wknauf on 31 October 2025, 11:35 am EST

  • Posted 31 October 2025, 11:35 am EST - Updated 31 October 2025, 11:41 am EST

    See attached sample: it loads two grids from xml files and calls “AutoSizeRows”. Depending on the sequence of actions, the second call results in a row that has wrong height.

    FlexGridRowHeight.zip

    To reproduce:

    1. click button “Load 1”
    2. click button “AutoSizeRows”
    3. click button “Load 2”
    4. click button “AutoSizeRows”.

    Now one row will be one pixel smaller than before:

    It only happens with this sequence of actions. Otherwise it might work.

    Do you have any idea? Is this something that might be caused by our grid? We use small rows as separator, maybe they have side effects.

    Best regards

    Wolfgang

  • Posted 3 November 2025, 2:26 am EST

    Hello Wolfgang,

    Thank you for sharing the sample and steps. We’re able to observe the behavior as well.

    We have escalated it to the development team for further insights. [Internal Tracking ID: C1WIN-34673]

    We’ll update you once we have more information.

    Regards,

    Uttkarsh.

  • Posted 4 November 2025, 7:16 am EST

    I did some more testing and subclassed C1FlexGrid and added an override of “CalculateCellHeight”. In there I printed the results.

    Attached is an updated sample (performs “AutoSizeRows” only in row 5, where the problem occurs).

    FlexGridRowHeight_2025-11-04.zip

    The output of my debugging code is this:

    CellHeight 5/0, measureSymbol = True: 17 (cell data: Musikhalle Komplett)
    CellHeight 5/1, measureSymbol = True: 35 (cell data: 03:00-23:59
    vor Buchung RS mit Frano)
    CellHeight 5/2, measureSymbol = True: -1 (cell data: )
    CellHeight 5/3, measureSymbol = True: -1 (cell data: )
    CellHeight 5/4, measureSymbol = True: -1 (cell data: )
    CellHeight 5/5, measureSymbol = True: 35 (cell data: 14:00-19:00 VA
    Stadt Ludwigsburg Pensionärsfeier)
    CellHeight 5/6, measureSymbol = True: 35 (cell data: 16:00-17:00 Abbau
    FB 63 Bürgerbeteiligung)
    CellHeight 5/7, measureSymbol = True: -1 (cell data: )
    CellHeight 5/6, measureSymbol = False: 32 (cell data: 16:00-17:00 Abbau
    FB 63 Bürgerbeteiligung)
    RowHeight: 32

    As you can see, it first measures each cell (which results in a reasonable value of “35” for row = 5 col = 6). Then it measures the last non empty cell in the row again and calculates “32”, which is the final row height.

    The final “CalculateCellHeight” call has the parameter “measureSymbol = false”, while all others use “true”.

    A workaround could be to ignore the “measureSymbol” parameter and set it always to “true”:

    protected override int CalculateCellHeight(Graphics g, int row, int col, bool skipHidden, bool skipMerged, bool measureSymbol, out int symbolRight)
    {
      return base.CalculateCellHeight(g, row, col, skipHidden, skipMerged, measureSymbol: true, out symbolRight);
    }

    What do you think? Is this a reasonable workaround, or would it break other stuff? At least it results in slightly higher rows.

    By the way: if I skip steps 1 and 2 in my initial list of steps to reproduce it and just click “Load 2” and “AutoSizeRows”, it prints heights of “36” and “33”, which is one more pixel. This one additional pixel makes the cell content render completely. But why does “CalculateCellHeight” return different values in this situation?

    Best regards

    Wolfgang

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels