I have a specialized application that is compute intensive with adjustable and occasional visual feedback into a component on the main form. My main form also has a slider that controls how the user can balance between calculation speed and UI response speed. I know how to create a background worker thread, but that's not my intention, as allowing the UI thread to process messages continuously slows my calculations down by several orders of magnitude. I want to deliberately block the UI thread as controlled by the slider. After a certain adjustable number of loops, I allow the UI to process messages with an Application.DoEvents() instruction in my code and at this time all pending UI updates are processed. I allow the looping to be controlled by the slider. 50 loops before UI freed gives a nice visual response time with no perceivable UI lag, and 2000 loops before UI freed takes about 15 seconds before the UI catches up, but boosts the calculation speed immensely.
That being said, is there any way to avoid a release mode program from cycling back and forth from "Not Responding" to regular mode when the slider is set to block the UI?
Thanks.
Thanks for all your responses. Thanks for your advice. There is a lot of interaction between the calculations and several UI components on the form. I have already tried the background thread with Invoke delegate based templates with extension method as suggested elsewhere on the internet and that works in the manner you suggest, but makes the calculations so slow as to be ridiculous. As a workaround, I can turn the component.visible to false and that only leaves the progress bar to update in real time, and that speeds things up almost as much as maxing out my slider, but it's frankly no fun to watch just the progress bar instead of seeing updates occur on the main visual component every 10 seconds or so. I am pushing a LOT of pixels around, that's all the information I can provide on this application for IP reasons. So my question remains, can I have my cake and eat it too? Can I turn off those windows messages that make my app form blink, or not? I have workarounds, none of which I really like, and comments that don't address the question directly are not useful to me. Thanks for your patience and understanding.