I am using the System.Drawing.Graphics.DrawLines(Pen pen, PointF[] points) method in a multithreaded application, but the System.Drawing.Graphics isn’t shared between threads.
Why it keeps throwing the System.InvalidOperationException: The object is currently in use elsewhere ?
The problem was: I was using the same System.Drawing.Pen instance for all threads. I had to clone it for every thread in order to solve the problem.
Even the lock is essential in order to solve this problem