Windows Form not refreshing after lost focus

  • Thread starter Thread starter Kevin Marshall
  • Start date Start date
K

Kevin Marshall

I have made a windows app in C# and it all works good apart from one
problem, the main form copies files around and can sometimes take a long
while so I have a progress bar and a label showing the current file being
processed. This all works great until you give another application focus and
then switch back to my app, after this the form does not redraw and the
progress bar stops updating, every thing works and the app starts responding
and drawing the form correctly once the current batch of files have been
processed but it look a bit un professional, any ideas what's causing this,
it has never happened with VB forms so could it be a bug in Visual C#?

Thanks in advance :)

--
Kevin Marshall
WebXeL.com Ltd
http://www.webxel.com

ASP.NET Dreamweaver Extensions
http://www.webxel-dw.co.uk
 
I think your best bet is to do the file copies on a separate thread so that
your GUI thread is not blocked by the copy. Or, use one of the asynchronous
copy methods - again to not block. If you do use a different thread,
remember to use a delegate and marshal the updates of the progress bar back
to the GUI thread properly.

Jerry
 
Back
Top