ok I have a time that ticks every 10ms to update one lable with the current mouse position, and also set a panel to the color unser the mouse
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim point As Point
point.X = Windows.Forms.Cursor.Position.X
point.Y = Windows.Forms.Cursor.Position.Y
lblMouse.Text = point.X & "," & point.Y
Dim color As Color
color = GetPixelColor(point.X, point.Y)
lblColor.Text = ColorTranslator.ToWin32(Drawing.Color.FromArgb(color.A, color.R, color.G, color.B)).ToString
pnlColor.BackColor = color
System.Windows.Forms.Application.DoEvents()
End Sub
while thats happening I want to be able to save the current mouse position and the color to a listbox when the user hits the 'w' key
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
If e.Equals(Keys.W) Then lstCommands.Items.Add(lblmouse.tostring & " :: " & lblcolor.tostring)
End Sub
As you can see I put DoEvents() but when I hit the w key nothing happens, I also tried removing the IF in form1_keypress and the keypress just doesnt activate.
Please help
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim point As Point
point.X = Windows.Forms.Cursor.Position.X
point.Y = Windows.Forms.Cursor.Position.Y
lblMouse.Text = point.X & "," & point.Y
Dim color As Color
color = GetPixelColor(point.X, point.Y)
lblColor.Text = ColorTranslator.ToWin32(Drawing.Color.FromArgb(color.A, color.R, color.G, color.B)).ToString
pnlColor.BackColor = color
System.Windows.Forms.Application.DoEvents()
End Sub
while thats happening I want to be able to save the current mouse position and the color to a listbox when the user hits the 'w' key
Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
If e.Equals(Keys.W) Then lstCommands.Items.Add(lblmouse.tostring & " :: " & lblcolor.tostring)
End Sub
As you can see I put DoEvents() but when I hit the w key nothing happens, I also tried removing the IF in form1_keypress and the keypress just doesnt activate.
Please help