Answer the question
In order to leave comments, you need to log in
How to organize inter-thread communication in winforms?
There are two threads, one of them inverts the image, the other should display the process of inverting itself using a progress bar. The question is how to transfer information from the stream that inverts the picture to the stream that displays the process.
Answer the question
In order to leave comments, you need to log in
The hard way: take a ConcurrentQueue , write a small message class, pass progress messages from a worker thread to a GUI thread (in a GUI thread, you check the message queue on a timer).
Another option, simpler, is to wrap the workflow in a converter class, make this class have a ProgressChanged event, pull the event using Invoke.
In general, there is a BackgroundWorker for this purpose - this is the easiest option, just right for you.
PS do not forget to use LockBits, otherwise it will work slowly.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question