【发布时间】:2010-10-08 02:49:29
【问题描述】:
这个很奇怪:
我的应用程序运行良好,但突然间,该死的 ListView 控件的事件不再引发。它只是来来去去,没有任何明确的理由。 (显然)我已将 AllowDrop 属性设置为 True,并按如下方式处理 DragEnter、DragOver 和 DragDrop 事件:
Private Sub lstApplications_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lstApplications.DragDrop, Me.DragDrop
m_fileNames = CType(e.Data.GetData(DataFormats.FileDrop), String())
mnuType.Show(Cursor.Position, ToolStripDropDownDirection.BelowLeft)
End Sub
Private Sub lstApplications_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles lstApplications.DragEnter, Me.DragEnter, lstApplications.DragOver, Me.DragOver
If chkMode.Checked OrElse Not e.Data.GetDataPresent(DataFormats.FileDrop, True) Then
e.Effect = DragDropEffects.None
Else
e.Effect = DragDropEffects.Copy
End If
End Sub
我在这两种方法中编写的代码无关紧要,因为没有引发任何事件。 我在这里有什么遗漏吗?
我在另一台机器上运行相同的应用程序,它运行良好。然后我重新启动了自己的机器,一切又开始工作了。我不确定,但 Windows 似乎出了点问题。
【问题讨论】:
标签: .net winforms listview drag-and-drop events