Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1440
Vertical Equivalent of AutoFitStyle.ResizeAllColumns
posted

Hello

I'm using a UltraWinGrid named ug1 and have set the following attributes:

 

            ug1.DisplayLayout.Override.RowSizing = RowSizing.AutoFree
            ug1.DisplayLayout.Override.CellMultiLine = DefaultableBoolean.True

There are times when a row is not completely shown heightwise at the bottom of the grid.  How can I accomplish the same effect of ResizeAllColumns vertically so rows are completely displayed?

Thanks

Clay Seifert

 

  • 469350
    Verified Answer
    Offline posted

    Hi Clay,

    There isn't any equivalent AutoFitStyle for rows. You can try to determine the amount of visible area in the grid and adjust the heights of the rows, of course, but this will be very tricky for a number of reasons.

    You will need to account for things like the scrollbar height (which you can get from the SystemInformation class, I think), the grid caption height (if there is one), the grid's borders, etc. You will also need to account for the fact that sometimes, rows in the grid overlap by a pixel or two in order to only display a single-line border between the rows.

    The best thing to do is probably to use the grid's UIElements to determine the available space and then adjust the visible rows from there.

    Also, since adjusting the row heights may affect the column widths, which may change the visibility of the scrollbars, you could run into an infinite loop.

    So there is no easy way to do this.