The*_*ent 11 .net events listview drag-and-drop winforms
这个很奇怪:
我的应用程序工作正常,但突然该死的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
Run Code Online (Sandbox Code Playgroud)
我在这两个方法中编写的代码无关紧要,因为没有引发任何事件.这里有什么我想念的吗?
我在另一台机器上运行相同的应用程序,它工作正常.然后我重新启动了自己的机器,一切都开始了.我不确定,但似乎Windows出了问题.
我只是因为类似的问题而遭受了数小时的苦难.拖放工作的三个强制要求:
AllowDrop="True",您不需要为整个应用程序,只需要您想要启用的元素.Background="Transparent"会做.| 归档时间: |
|
| 查看次数: |
11299 次 |
| 最近记录: |