You can allow the end user to drag-and-drop data from one range of cells to another. You can specify whether the user can select a cell or range of cells and drag and drop them to a new location in the same spreadsheet or another spreadsheet in the Spread component. When the mouse button is released and the range of cells is dropped, the DragDropBlock event occurs.
For more information, refer to the AllowDragDrop property in the FpSpread class. For more information on event arguments, refer to DragDropBlock event, DragDropBlockEventArgs, and DragDropBlockCompletedEventArgs.
For a demonstration of the drag-and-drop feature, refer to the sample project in Start > Programs > GrapeCity > Spread for Windows Forms > Samples.
Return to Using Drag Operations to Fill Cells.
Using the Properties Window
- At design time, in the Properties window, select the Spread component.
- Select (in the Behavior category) the AllowDragDrop property.
- Select True from the drop-down list to allow drag-and-drop feature, or select False to prohibit it.
Using a Shortcut
Allow the drag-and-drop feature by setting the AllowDragDrop property for the FpSpread component.
Example
This example code sets the component to allow the drag-drop feature.
C# | Copy Code |
---|---|
fpSpread1.AllowDragDrop = true;
|
VB | Copy Code |
---|---|
FpSpread1.AllowDragDrop = True
|
Using Code
Allow the drag-and-drop feature by setting the AllowDragDrop property of the FpSpread component.
Example
This example code sets the child sheet to allow the drag-drop feature.
C# | Copy Code |
---|---|
FarPoint.Win.Spread.SpreadView sv = fpSpread1.GetRootWorkbook();sv.AllowDragDrop = true;
|
VB | Copy Code |
---|---|
Dim sv As FarPoint.Win.Spread.SpreadView = FpSpread1.GetRootWorkbooksv.AllowDragDrop = True |
Using the Spread Designer
- From the Settings menu, select General (Spread Settings section).
- In the General tab, select the settings for the drag and drop properties as needed.
- Click OK.
- From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.
or
- Select the Spread component (or select Spread from the pull-down menu).
- In the property list for the component (in the Behavior category), select the AllowDragDrop property.
- Click the drop-down arrow to display the choices and select True.
- From the File menu choose Apply and Exit to apply your changes to the component and exit Spread Designer.