Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
1.11/5 (2 votes)
See more:
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.
Posted
Comments
KAUTIKPATEL 9-Aug-13 0:11am    
I already use a 3 event mouseUp ,mouseDown and mouseMove for moving a label at runtime and also use same event for resize a font size.
lukeer 9-Aug-13 2:54am    
That's good. Where exactly is your problem in moving several labels instead of one?
KAUTIKPATEL 9-Aug-13 6:02am    
acctually,
I want to do same as we select a multiple label or control at form design time.
using mouse dragging and we can see mouse draging caption.
lukeer 9-Aug-13 6:16am    
I got that. But since you already got the dragging of one label to work, where exactly is the problem doing so for multiple labels?

1 solution

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.

VB
Private myDragLabels As New List(Of Label)


In mouseUp event:

VB
myDragLabels.Add({label under mouse})


In mouseMove:

VB
For Each lb As Label In myDragLabels
  'change the x/y coordinates
Next
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900