Design Time Interaction > Context Menu |
Right-click anywhere on the grid to display the True DBGrid context menu, which is a superset of the context menu that Visual Basic provides for all ActiveX controls.
The first eight commands are controlled by Visual Basic; the last four commands are controlled by True DBGrid. The context menu commands operate as follows.
Cut, Copy, Paste, Delete
These commands are identical to those on the Visual Basic Edit menu. Cut (Ctrl+X) moves the grid from the Visual Basic form to the Clipboard. Copy (Ctrl+C) moves a copy of the grid to the Clipboard while leaving the grid on the form intact. Paste (Ctrl+V) copies the grid from the Clipboard to the form. Delete (the Del key) removes the grid but does not move it to the Clipboard. You can undo the Delete command by selecting Undo (Ctrl+Z) from the Visual Basic Edit menu.
Bring To Front, Send To Back
These commands control the z-order of the grid relative to the other objects on the Visual Basic form. Bring To Front (Ctrl+J) places the grid in front of other objects; Send To Back (Ctrl+K) places it behind other objects. These commands are also available from the Visual Basic Edit menu. The Zorder (Visual Basic) method can be used to change the z-order of controls at run time.
View Code
This command displays the grid's code window, which enables you to view and edit the grid's event handling code.
Align to Grid
This command automatically aligns the outer edges of the grid control to the design-time grid lines on the form.
Edit
This command switches to True DBGrid's visual editing mode, in which you can interactively change the grid's column layout and row height. Within visual editing mode, you can right-click anywhere on the grid to display a different context menu called the visual editing menu. Using the visual edit menu, you can manipulate individual columns and splits directly on the surface of the grid. For convenience, the visual editing menu also contains some of the context menu commands. For details, see Visual Editing Mode.
Properties
This command displays the grid's property pages, which enable you to customize the layout and appearance of the grid at design time. You can also display the property pages by selecting (Custom) from the Visual Basic Properties window. For details, see Property Page Overview.
Retrieve Fields
This command automatically configures the grid's columns according to the schema information obtained from the Data control's Recordset. If you have already changed the grid's default layout, True DBGrid will ask for confirmation before discarding your changes. By default, the grid will use the database field names, or SQL aliases, as the column headings. If all of the columns do not fit in the visible portion of the grid, a horizontal scroll bar will appear. The scroll bar is usable only when the grid is in visual editing mode as described in the next section.
Clear Fields
This command clears all column layouts and field names. Use this command to force a bound grid to use automatic layouts at run time.