Microsoft KB Archive/141722

= How to Prevent a Grid Header from Being Resized Interactively =

Article ID: 141722

Article Last Modified on 9/30/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b Standard Edition

-



This article was previously published under Q141722



SUMMARY
In a grid object, the default behavior allows a user to resize the header by clicking and dragging it. The grid header could potentially be pulled down so that it covers the entire grid object and all of the data contained within it. This article demonstrates how to use program code to prevent a user from resizing the header of a grid.



MORE INFORMATION
The following example creates a new property for the form to store the original size of the grid's HeaderHeight Property. Then, in the MouseUp event of the grid, the HeaderHeight Property is reset to its the original size should a user attempt to change it while running the form.

Step-by-Step Example
 Create a new form. On the Form menu, click New Property, and create a property called oldheadheight.  Place the following code in the Init event of the form: THIS.oldheadheight=THISFORM.Grid1.HeaderHeight   Add the Customer table to the Data Environment of the form (on the View menu, click Data Environment, and then right-click within the Data Environment and select Add. Within the Add Table or View dialog box, select Other and locate the Customer.dbf as follows:   C:\Vfp\Samples\Data\Customer.dbf                         Click the title bar of the Customer table, and drag it onto the form to create a grid. With the grid as the selected object on the form, set the ColumnCount property to 4.</li>  Add the following code to the MouseUp event of the grid:    THIS.HeaderHeight=THISFORM.oldheadheight                        </li> Save the form as Test. Close it, and use the DO FORM command to run the form.</li> Attempt to resize the header by clicking and dragging from the top, left corner of the grid and notice that it snaps back to its original position once the mouse button is released.</li></ol>

Additional query words: VFoxWin

Keywords: KB141722

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.