In case I have a big drawing with all kinds of geometric forms (lines, rectangles, circles, e.t.c.) it takes a lot of time for the thread to draw everything. But in real life, one building is built by more than one workers. So if the drawing is the building and the threads are the builders, it will get drawn a lot faster. But I want to know how.
Can you tell me how? Is it even possible (though I have already asked and the answer was "Yes")? Is it worth it to be used? What are the risks?
If there are questions that I have missed, please tell me about them and answer them.
Thanks!
Assuming you are using GDI+ and the System.Drawing.Graphics
object to render your graphics (rectangles, circles, etc.) to a background drawing surface (e.g. System.Drawing.Bitmap
Object): Instance members of the System.Drawing.Graphics
object that you would need to use are not thread safe. See MSDN documentation here
Given this, I would not use more than one "builder" thread to render your graphics.
Instead, my recommendation would be to do all of your drawing to a System.Drawing.Bitmap
object in a single background thread rather than multiple background threads if possible. You can use a status bar or other indicator to let the user know that your program is working in the background.