欢迎光临
我们一直在努力

托拽Explore中的文件到VB.net的窗口 40Star(原作)-.NET教程,Windows开发

建站超值云服务器,限时71元/月

托拽explore中的文件到vb.net的窗口    40star(原作)  
  
关键字     wm_dropfiles vb.net
  

要让vb.net相应外部托拽来的文件,需处理wm_dropfiles消息。

private declare sub dragacceptfiles lib "shell32.dll" (byval hwnd as int32, byval faccept as int32)
private declare sub dragfinish lib "shell32.dll" (byval hdrop as int32)
private declare function dragqueryfile lib "shell32.dll" alias "dragqueryfilea" (byval hdrop as int32, byval uint as int32, byval lpstr as

string, byval ch as int32) as int32

private const wm_dropfiles = &h233
private const max_length = 255

protected overrides sub wndproc(byref m as system.windows.forms.message)
    if m.msg = wm_dropfiles then
        dragfiles(m.wparam.toint32)
        exit sub
    end if
    mybase.wndproc(m)
end sub

private sub dragfiles(byval hdrop as int32)
    dim ireturn as int32
    dim sfile as string
    sfile = space(max_length)
    ireturn = dragqueryfile(hdrop, 0, sfile, max_length)
    if ireturn then
        textbox3.text = sfile
        picturebox1.image = image.fromfile(trim(textbox3.text))
        dragfinish(hdrop)
    end if
end sub

我的代码只是适用于.net的picturebox能用的图像文件噢!

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » 托拽Explore中的文件到VB.net的窗口 40Star(原作)-.NET教程,Windows开发
分享到: 更多 (0)

相关推荐

  • 暂无文章