MultiRow Windows Forms > Developer's Guide > Using MultiRow > Grid > Points to Note with Default Settings |
By default, GcMultiRow provides all the features that are normally provided by a grid control and other general applications. The following topics discuss how to limit the grid's functions.
Normally, the user can add rows by entering a new row. To disable this feature, set the GcMultiRow.AllowUserToAddRows property to False.
This example shows how to prevent users from adding new rows when entering a new row.
GcMultiRow1.AllowUserToAddRows = False |
gcMultiRow1.AllowUserToAddRows = false; |
By default, the user can delete rows using the Ctrl + Delete keys. To disable this feature, set the GcMultiRow.AllowUserToDeleteRows property to False.
This example prevents users from deleting rows.
GcMultiRow1.AllowUserToDeleteRows = False |
gcMultiRow1.AllowUserToDeleteRows = false; |
For details on the default shortcut keys, refer to Shortcut Keys.
By default, the user can zoom in or out of the grid using the mouse or keyboard. To disable this feature, set the GcMultiRow.AllowUserToZoom property to False.
This example shows how to not allow users to zoom the grid.
GcMultiRow1.AllowUserToZoom = False |
gcMultiRow1.AllowUserToZoom = false; |
By default, the user can copy the cell values using the keyboard. To disable this feature, set the GcMultiRow.AllowClipboard property to False.
This example prevents users from copying cell values using the keyboard.
GcMultiRow1.AllowClipboard = False |
gcMultiRow1.AllowClipboard = false; |
By default, the cell editing control of each cell is provided with clipboard functionality. For example, clipboard operations are enabled while editing the text box cell, since it uses the TextBoxEditingControl. This is the same as the standard TextBox controls.
This example disables this clipboard functionality.
Imports GrapeCity.Win.MultiRow Private Sub GcMultiRow1_EditingControlShowing(ByVal sender As System.Object, ByVal e As EditingControlShowingEventArgs) Handles GcMultiRow1.EditingControlShowing If TypeOf e.Control Is TextBoxEditingControl Then Dim textBoxEditingControl As TextBoxEditingControl = _ DirectCast(e.Control, TextBoxEditingControl) ' Disable the context menu by assigning an empty context menu textBoxEditingControl.ContextMenu = New ContextMenu() ' Disable the clipboard operations through keyboard RemoveHandler textBoxEditingControl.KeyDown, AddressOf Me.textBoxEditingControl_KeyDown AddHandler textBoxEditingControl.KeyDown, AddressOf Me.textBoxEditingControl_KeyDown End If End Sub Private Sub textBoxEditingControl_KeyDown(ByVal sender As System.Object, ByVal e As KeyEventArgs) Dim textBox As TextBox = DirectCast(sender, TextBox) If e.Modifiers = Keys.Control Then e.Handled = True textBox.SelectionLength = 0 End If End Sub |
using GrapeCity.Win.MultiRow; private void Form1_Load(object sender, EventArgs e) { gcMultiRow1.EditingControlShowing += new EventHandler<EditingControlShowingEventArgs>(gcMultiRow1_EditingControlShowing); } private void gcMultiRow1_EditingControlShowing(object sender, EditingControlShowingEventArgs e) { if (e.Control is TextBoxEditingControl) { TextBoxEditingControl textBoxEditingControl = e.Control as TextBoxEditingControl; // Disable the context menu by assigning an empty context menu textBoxEditingControl.ContextMenu = new ContextMenu(); // Disable the clipboard operations through keyboard textBoxEditingControl.KeyDown -= new KeyEventHandler(textBoxEditingControl_KeyDown); textBoxEditingControl.KeyDown += new KeyEventHandler(textBoxEditingControl_KeyDown); } } private void textBoxEditingControl_KeyDown(object sender, KeyEventArgs e) { TextBox textBox = sender as TextBox; if (e.Modifiers == Keys.Control) { e.Handled = true; textBox.SelectionLength = 0; } } |
User input is allowed by default in the editable cell types, for example, TextBoxCell or DateTimePickerCell. To disable this feature, use either of the following.
By default, it is possible to select all the cells except the header cell and its inherited classes. To disable this functionality, you can use either of the following.
By default, cells can be resized using the header cell and its inherited classes. To disable resizing by the user, set the GcMultiRow.AllowUserToResize property to False. To disable the resizing in individual cells, use the Cell.ResizeMode property. By default, resizing is allowed for each of the following cell types:
By default, the user can input null (Nothing in Visual Basic) using Ctrl + 0. You can delete the corresponding shortcut keys to disable this feature.
The following example prevents the user from inputting a null value using the Ctrl + 0 keys.
GcMultiRow1.ShortcutKeyManager.Unregister(GrapeCity.Win.MultiRow.EditingActions.InputNullValue) |
gcMultiRow1.ShortcutKeyManager.Unregister(GrapeCity.Win.MultiRow.EditingActions.InputNullValue); |
The cell width is auto-adjusted based on its contents when you double-click the border of the column header cell. By default, the target cells are limited to the area that is displayed on the screen. To make all cells the target cells, change the GcMultiRow.AutoFitContent property to All.
The following example makes all the cells auto-adjust when the user double-clicks the border of the column header cell.
GcMultiRow1.AutoFitContent = GrapeCity.Win.MultiRow.AutoFitContent.All |
gcMultiRow1.AutoFitContent = GrapeCity.Win.MultiRow.AutoFitContent.All; |
When the control has a lot of data, the processing time increases depending on the amount of data.
The new features of 7.0 that affect the compatibility with version 6.0, are disabled by default. These features include those which are generally expected as default behavior.
The following code enables these features.
GcMultiRow1.AllowUserToReverseSelect = True GcMultiRow1.AllowUserToShiftSelect = True |
gcMultiRow1.AllowUserToReverseSelect = true; gcMultiRow1.AllowUserToShiftSelect = true; |
For information about other new features of 7.0, refer to Feature Comparison.