GrapeCity MultiRow Windows Forms Documentation
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.

Adding Rows

Normally, the user can add rows by entering a new row. To disable this feature, set the GcMultiRow.AllowUserToAddRows property to False.

Using Code

This example shows how to prevent users from adding new rows when entering a new row.

[VB]

GcMultiRow1.AllowUserToAddRows = False

[CS]

gcMultiRow1.AllowUserToAddRows = false;

Deleting Rows

By default, the user can delete rows using the Ctrl + Delete keys. To disable this feature, set the GcMultiRow.AllowUserToDeleteRows property to False.

Using Code

This example prevents users from deleting rows.

[VB]

GcMultiRow1.AllowUserToDeleteRows = False

[CS]

gcMultiRow1.AllowUserToDeleteRows = false;

For details on the default shortcut keys, refer to Shortcut Keys.

Zoom

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.

Using Code

This example shows how to not allow users to zoom the grid.

[VB]

GcMultiRow1.AllowUserToZoom = False

[CS]

gcMultiRow1.AllowUserToZoom = false;

Clipboard Operations (Grid)

By default, the user can copy the cell values using the keyboard. To disable this feature, set the GcMultiRow.AllowClipboard property to False.

Using Code

This example prevents users from copying cell values using the keyboard.

[VB]

GcMultiRow1.AllowClipboard = False

[CS]

gcMultiRow1.AllowClipboard = false;

Clipboard Operations (Cell Editing Control)

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.

Using Code

This example disables this clipboard functionality.

[VB]

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

[CS]

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;
    }
}

Editing Cell values

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.

Cell Selection

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.

Resizing Cells

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:

Input Null Values

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.

Using Code

The following example prevents the user from inputting a null value using the Ctrl + 0 keys.

[VB]

GcMultiRow1.ShortcutKeyManager.Unregister(GrapeCity.Win.MultiRow.EditingActions.InputNullValue)

[CS]

gcMultiRow1.ShortcutKeyManager.Unregister(GrapeCity.Win.MultiRow.EditingActions.InputNullValue);

Cell Autosize

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.

Using Code

The following example makes all the cells auto-adjust when the user double-clicks the border of the column header cell.

[VB]

GcMultiRow1.AutoFitContent = GrapeCity.Win.MultiRow.AutoFitContent.All

[CS]

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.

New Features of 7.0

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.

Using Code

The following code enables these features.

[VB]

GcMultiRow1.AllowUserToReverseSelect = True
GcMultiRow1.AllowUserToShiftSelect = True

[CS]

gcMultiRow1.AllowUserToReverseSelect = true;
gcMultiRow1.AllowUserToShiftSelect = true;

For information about other new features of 7.0, refer to Feature Comparison.

See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options