Edit: Nevermind... I just changed the tabindex of the listbox to 0 and it fixed the problem
I am making an operating system upgrade game but I am having an odd issue with one of my forms. Basically a feature allows you to move windows around the screen by having them in focus and then holding shift while pressing the arrow key direction you want them to go. For example "Shift + left" will make a window move left 50 pixels.
I have set key preview to true on all my windows so a certain control doesn't have to be selected. All windows are moving perfectly with the same code except for one called "Shiftorium" which will only move if I have selected an upgrade from the list. If no upgrade is selected then the window can not be moved with the arrow keys like usual.
Here is a picture of the shiftorium when first opened which is unable to move:
![Name: notworking.png
Views: 71
Size: 34.7 KB]()
Here is a picture of the shiftorium once an upgrade is clicked allowing it to be moved:
![Name: working.png
Views: 58
Size: 25.6 KB]()
Here is the universal code used to move all windows with the arrow keys which only seems to work on the shiftorium if the listbox with upgrades is clicked:
Please help me understand what the hell is happening here. Thanks it advance :)
I am making an operating system upgrade game but I am having an odd issue with one of my forms. Basically a feature allows you to move windows around the screen by having them in focus and then holding shift while pressing the arrow key direction you want them to go. For example "Shift + left" will make a window move left 50 pixels.
I have set key preview to true on all my windows so a certain control doesn't have to be selected. All windows are moving perfectly with the same code except for one called "Shiftorium" which will only move if I have selected an upgrade from the list. If no upgrade is selected then the window can not be moved with the arrow keys like usual.
Here is a picture of the shiftorium when first opened which is unable to move:
Here is a picture of the shiftorium once an upgrade is clicked allowing it to be moved:
Here is the universal code used to move all windows with the arrow keys which only seems to work on the shiftorium if the listbox with upgrades is clicked:
Code:
Private Sub ShiftOSDesktop_keydown(sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
'Make terminal appear
If e.KeyCode = Keys.T AndAlso e.Control Then
Terminal.Show()
Terminal.Visible = True
Terminal.BringToFront()
End If
'Movable Windows
If ShiftOSDesktop.boughtmovablewindows = True Then
If e.KeyCode = Keys.Left AndAlso e.Shift Then
e.Handled = True
Me.Location = New Point(Me.Location.X - ShiftOSDesktop.movablewindownumber, Me.Location.Y)
End If
If e.KeyCode = Keys.Right AndAlso e.Shift Then
e.Handled = True
Me.Location = New Point(Me.Location.X + ShiftOSDesktop.movablewindownumber, Me.Location.Y)
End If
If e.KeyCode = Keys.Up AndAlso e.Shift Then
e.Handled = True
Me.Location = New Point(Me.Location.X, Me.Location.Y - ShiftOSDesktop.movablewindownumber)
End If
If e.KeyCode = Keys.Down AndAlso e.Shift Then
e.Handled = True
Me.Location = New Point(Me.Location.X, Me.Location.Y + ShiftOSDesktop.movablewindownumber)
End If
End If
End Sub