Spread Windows Forms 9.0 Product Documentation
DragDropBlock Event
Example 


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
ActionGets or sets whether the source range is copied or moved.  
CancelGets or sets whether the copying or moving of data is cancelled.  
ColumnBeginGets the column index of the top left cell of the source range (being dragged).  
ColumnEndGets the column index of the bottom right cell of the source range (being dragged).  
DataOnlyGets or sets whether data or formatting (or both) is copied or moved.  
DestinationColumnBeginGets the column index of the top left cell of the destination range (where selection is dropped).  
DestinationColumnEndGets the column index of the bottom right cell of the destination range (where selection is dropped).  
DestinationRowBeginGets the row index of the top left cell of the destination range (where selection is dropped).  
DestinationRowEndGets the row index of the bottom right cell of the destination range (where selection is dropped).  
OverwriteGets whether the destination range contains data (that is overwritten).  
RowBeginGets the row index of the top left cell of the source range (being dragged).  
RowEndGets 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
Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows Server 2012 R2, Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10

See Also

Reference

FpSpread Class
FpSpread Members
DragDropBlockEventArgs Class

 

 


Copyright © GrapeCity, inc. All rights reserved.