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
175
Grid width
posted

My UltraWinGrid is set inside a winfom with Dock.Fill set.  As columns are added I would like the winform to be at least as wide as the number of columns, provided it does not exceed the screen width.

Does anyone know how I can get the total size of the grid columns so I can set the winform Size accordingly?

  • 130
    posted

    Do i understand right that you would like to expand the grid control or the whole form (more likely as you have the grid with Dock.Fill) width as columns are added?

    Why not loop trough the columns collection and add up the width of of all columns in an variable and then add some pixels for control borders and such?

    Kinda unprofessional, i know, but i don't think there is an direct property for the total width of all columns in an band or the whole grid (all bands), I could be wrong of course :).

    Problem would be if you use stuff like CardView or RowLayout.

     

     

  • 69832
    Suggested Answer
    Offline posted

    I'm not sure if this helps you, but the UltraGrid.DisplayLayout.AutoFitStyle property gives you a way to negotiates the width of the columns so that they all fit, without a horizontal scrollbar being displayed.