100% CPU look, how to draw/redraw form?

  • Thread starter Thread starter Olav Tollefsen
  • Start date Start date
O

Olav Tollefsen

I have a program which does a tight loop. When I invoke the winforms
application, I enter the loop and the user interface does not appear on the
screen. The user interface should only display some status counters on the
form.

How should I construct the application to draw the userinterface and update
the counters (DataGrid) when running in my tight loop?

Olav
 
Put an Application.DoEvents In your loop..

bool doit = true
while (doit
{
Application.DoEvents()
..
..
doit = false


It also Depends on your design of your form relaunching your code..

If you do a DirectX 9.0 managed program you show the form so that you can process the events and still do
all the rendering Like follows: My FOrms that do heavy 3d rendering use a launch routine like this.

using (DesignForm designForm = new DesignForm()

designForm.MdiParent=this
designForm.Show()
// While the form is still valid, render and process message
while(designForm.Created

designForm.Render()
Application.DoEvents()

}
 
Back
Top