1

This line throws the exception (I'm talking about a windows form. the PointToClient is a method of the form):

double x = PointToClient(Cursor.Position).X / this.Width;

Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on.

What control is being accessed? I know I should use invoke, but what control should I invoke? I'm really puzzled.

ByoTic
  • 333
  • 1
  • 4
  • 16
  • 1
    Just write the error message to google. First Result....... – L.B Jul 21 '14 at 18:18
  • @L.B The poster already mentioned that - "I know I should use invoke" - its actually NOT a duplicate of the other... The problem here was the OP didn't realize the form itself is a control, I believe. – Reed Copsey Jul 21 '14 at 18:18

1 Answers1

0

What control is being accessed?

this is the Form, which derives from Control. You can use this.Invoke to marshal it back to the UI thread.

Reed Copsey
  • 554,122
  • 78
  • 1,158
  • 1,373