当前位置:首页 > 通信资讯 > 正文

winform 拖动窗体(winform控件移动)

本文实例讲述了winform实现拖动文件到窗体上的方法。分享给大家供大家参考。具体如下:

?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 private void Form5_Load(object sender, EventArgs e) { this.AllowDrop=true; } private void Form5_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); foreach (string f in files) { listBox1.Items.Add(f); } } }

希望本文所述对大家的C#程序设计有所帮助。

如果您对该产品感兴趣,请填写办理(客服微信:xiaoxiongyidong)

为您推荐:

发表评论

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。