Spread Windows Forms 11.0 Product Documentation
DragDropBlock Event
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > FpSpread Class : DragDropBlock Event
Occurs when the user drags and drops a range of cells.
Syntax
'Declaration
 
Public Event DragDropBlock As DragDropBlockEventHandler
'Usage
 
Dim instance As FpSpread
Dim handler As DragDropBlockEventHandler
 
AddHandler instance.DragDropBlock, handler
public event DragDropBlockEventHandler DragDropBlock
Event Data

The event handler receives an argument of type DragDropBlockEventArgs containing data related to this event. The following DragDropBlockEventArgs properties provide information specific to this event.

PropertyDescription
Gets or sets whether the source range is copied or moved.  
Gets or sets whether the copying or moving of data is cancelled.  
Gets the column index of the top left cell of the source range (being dragged).  
Gets the column index of the bottom right cell of the source range (being dragged).  
Gets or sets whether data or formatting (or both) is copied or moved.  
Gets the column index of the top left cell of the destination range (where selection is dropped).  
Gets the column index of the bottom right cell of the destination range (where selection is dropped).  
Gets the row index of the top left cell of the destination range (where selection is dropped).  
Gets the row index of the bottom right cell of the destination range (where selection is dropped).  
Gets whether the destination range contains data (that is overwritten).  
Gets the row index of the top left cell of the source range (being dragged).  
Gets the row index of the bottom right cell of the source range (being dragged).  
Remarks

This event is raised by the OnDragDropBlock method when the user drags and drops a range of cells.

For more details on the individual event arguments, refer to DragDropBlockEventArgs members.

Example
This example raises the event.
DialogResult dlg;
fpSpread1.ActiveSheet.SetValue(0, 0, "Drag");
fpSpread1.ActiveSheet.SetValue(1, 0, "And");
fpSpread1.ActiveSheet.SetValue(2, 0, "Drop");
dlg = MessageBox.Show("If you want to Drag+Drop click the YES button and place the mouse pointer on the edge of the selection
then drag and drop.This will fire the event.", "DragDrop", MessageBoxButtons.YesNo);
if (dlg == DialogResult.Yes)
{
     fpSpread1.ActiveSheet.AddSelection(0, 0, 3, 1);
     fpSpread1.AllowDragDrop = true;
}

private void fpSpread1_DragDropBlock(object sender, FarPoint.Win.Spread.DragDropBlockEventArgs e)
{
     ListBox1.Items.Add("DragDropBlock event fired!");
}
Dim dlg As DialogResult
FpSpread1.ActiveSheet.SetValue(0, 0, "Drag")
FpSpread1.ActiveSheet.SetValue(1, 0, "And")
FpSpread1.ActiveSheet.SetValue(2, 0, "Drop")
dlg = MessageBox.Show("If you want to Drag+Drop click the YES button and place the mouse pointer on the edge of the selection
then drag and drop.This will fire the event.", "DragDrop", MessageBoxButtons.YesNo)
If dlg = DialogResult.Yes Then
     FpSpread1.ActiveSheet.AddSelection(0, 0, 3, 1)
     FpSpread1.AllowDragDrop = True
End If

Private Sub FpSpread1_DragDropBlock(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.DragDropBlockEventArgs) Handles
FpSpread1.DragDropBlock
     ListBox1.Items.Add("DragDropBlock event fired!")
End Sub
See Also