【问题标题】:Drag and Drop from another application with mouse button down does not fire event使用鼠标按钮从另一个应用程序拖放不会触发事件
【发布时间】:2010-06-18 10:51:30
【问题描述】:

我正在尝试将文件拖放到我的应用程序中的控件上。问题是当您按住鼠标按钮时(即从寡妇资源管理器中拖动),我的应用程序不会触发任何表单事件。如果鼠标没有按下,它们都可以正常工作。似乎我需要为应用程序启用“AllowDrop”(它在表单上启用)

我错过了什么?

我在windows 7环境下用vb.net 2008开发

【问题讨论】:

    标签: windows-explorer drag-and-drop


    【解决方案1】:

    AllowDrop 需要为您要放置的控件/对象启用。

    您还需要在EnterDragOver 事件中更新DragDropEffects。这使您可以验证支持或不支持的放置项目并提供反馈。

    Private Sub UserControl11_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles UserControl11.DragEnter
        e.Effect = DragDropEffects.All    
    End Sub
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-04-24
      • 2013-07-23
      • 1970-01-01
      • 2011-11-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多