![]() |
|
two vb.net problems - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Visual Basic & .NET Framework (https://sinister.ly/Forum-Visual-Basic-NET-Framework) +--- Thread: two vb.net problems (/Thread-two-vb-net-problems) |
two vb.net problems - FrostByte_mybb_import5923 - 04-18-2011 i have 2 problems, can anyone help me. what are my issues: firstly - how to select a picture box or all picturbox's in the application like select all but for pictureboxes. second - how to make the selected pictureboxes move to certain mouse click locations, but actually move there and not just jump. RE: two vb.net problems - Coder-san - 04-18-2011 1) It's something like: Code: For Each pic As PictureBox In Me.Controls
pic.cls 'Or whatever
Next2) Use a dynamic array of Point. It will be really tricky, I can't help you on this one currently sorry. RE: two vb.net problems - FrostByte_mybb_import5923 - 04-18-2011 wow something coder cant help on never thought id see that, and thanks for help on the first one RE: two vb.net problems - Coder-san - 04-18-2011 I can try to make it, but I'm currently working on something else. :p Should be something like: Code: Dim ArrPoint As Point()
Private Sub MoveObject()
Dim intIndex As Integer = 0
For Each pic As PictureBox in Me.Controls
Redim Preserve ArrPoint(intIndex) 'Expanding our Array
Do While pic.Location.X < ArrPoint.X
pic.Location.X += 2
Threading.Thread.Sleep(100)
Loop
Do While pic.Location.X > ArrPoint.X
pic.Location.X -= 2
Threading.Thread.Sleep(100)
Loop
Do While pic.Location.Y < ArrPoint.Y
pic.Location.Y += 2
Threading.Thread.Sleep(100)
Loop
Do While pic.Location.Y > ArrPoint.Y
pic.Location.Y -= 2
Threading.Thread.Sleep(100)
Loop
intIndex += 1
Next
End Sub |