Grid Resizing

Hello All,

I have a query to do with resizing forms and grids in VFP. I have a grid on a form with 8 columns. In the resize event of the form I have put code to resize the grid at the same time so it matches the Width and Height of the form. However, I have come across a problem with resizing the columns within the grid. Ideally, I would like to adjust each columns width as the grid is being resized. (I.E. Columns will grow when the grid is made larger and shrink as the grid is made smaller.) Has anyone every handled this situation

Cheers,

Todd



Answer this question

Grid Resizing

  • panthraz

    Thanks Mark. That worked a treat

     

    All the Best


  • Mohit Gupta - MSFT

    As with the resizing of any object, you need to know what the original size of a particular dimension was when the form was first launched. For grid columns, one way is to loop through the Columns collection in the INIT of the grid. You will need to add a nOriginalWidth (or whatever name) property and set its value to the original width of that column --

    FOR EACH loColumn IN THIS.Columns
         loColumn.AddProperty('nOriginalWidth', loColumn.Width)
    ENDFOR

    In the RESIZE of the Grid, you would loop through the Columns collection again to resize each column proportionally to their original size and the original/new size of the grid. I am assuming you already have established a property for the original width of the grid.



  • Grid Resizing