回复 1楼AccessZHB的帖子
Private Sub FpSpread1_DragDrop(sender As System.Object, e As System.Windows.Forms.DragEventArgs) Handles FpSpread1.DragDrop
If (e.Data.GetDataPresent(GetType(ListViewItem))) Then
Dim item As ListViewItem = e.Data.GetData(GetType(ListViewItem))
' Perform drag-and-drop, depending upon the effect.
If (e.Effect = DragDropEffects.Copy Or _
e.Effect = DragDropEffects.Move) Then
Dim Pt As New Point(e.X, e.Y)
Dim spreadPoint As Point = FpSpread1.PointToClient(Pt)
Business.Helper.SetActiveCellWithRighButton(FpSpread1, spreadPoint)
Dim hitInfo As FarPoint.Win.Spread.HitTestInformation = spr.HitTest(spreadPoint.X, spreadPoint.Y)
If Not hitInfo.ViewportInfo Is Nothing Then
If spr.ActiveSheet.ActiveRowIndex <> hitInfo.ViewportInfo.Row OrElse spr.ActiveSheet.ActiveColumnIndex <> hitInfo.ViewportInfo.Column Then
spr.ActiveSheet.SetActiveCell(hitInfo.ViewportInfo.Row, hitInfo.ViewportInfo.Column)
End If
End If
FpSpread1.ActiveSheet.ActiveCell.Value = item.Text
End If
End If
End Sub |