码迷,mamicode.com
首页 > Web开发 > 详细

[VB.NET]拖动操作的技术基础

时间:2014-09-07 00:57:54      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   ar   for   文件   div   sp   代码   

1、设置需要接受拖动事件的控件的AllowDrop属性为True,在开发界面时配置,不可通过代码配置

2、在DragEnter事件处理程序里,为e.Effet设置枚举值,否则拖动无效

    Private Sub GroupBox1_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles GroupBox1.DragEnter
        e.Effect = DragDropEffects.Link
    End Sub

3、在DragDrop事件中处理拖入的内容

    Private Sub GroupBox1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles GroupBox1.DragDrop
        s = e.Data.GetData(System.Windows.Forms.DataFormats.FileDrop)
        Me.Text = "File Pro - 正在移动文件"
    End Sub

 4、获取拖入的内容

s = e.Data.GetData(System.Windows.Forms.DataFormats.FileDrop)

 

[VB.NET]拖动操作的技术基础

标签:style   blog   color   ar   for   文件   div   sp   代码   

原文地址:http://www.cnblogs.com/sunsoftresearch/p/3959957.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!