使用鼠标在运行时选择多个标签并移动它 [英] select multiple label at run time using mouse and move it

查看:76
本文介绍了使用鼠标在运行时选择多个标签并移动它的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在运行时使用鼠标拖动在窗体上选择多个标签,并在运行时将所有标签移动到所选标签。

I want to select multiple label at run time using mouse draging on form and move it at run time all label which is selected.

推荐答案

你需要一种方法将标签添加到集合中然后在移动时迭代集合并更改x / y值,就像在单个标签上进行一样,它们将移动。



You need a way to add the labels to a collection then when moving you iterate the collection and change the x/y values, like your doing on the single label, and they will move.

Private myDragLabels As New List(Of Label)





在mouseUp事件中:





In mouseUp event:

myDragLabels.Add({label under mouse})





在mouseMove中:





In mouseMove:

For Each lb As Label In myDragLabels
  'change the x/y coordinates
Next


这篇关于使用鼠标在运行时选择多个标签并移动它的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆