Home > Software engineering >  MFC progress bar
MFC progress bar

Time:09-17

Would you please tell me why the progress bar in the outside don't go after a cycle? Is a progress bar can not be repeated load? It's can load a code:

M_progress. SetRange (0, 100);

M_progress. SetPos (0);
M_progress. Invalidate ();

int i=1;
for (; I & lt;=100; I++)
{
M_progress. SetPos (I);
}
How to implement a progress bar repeatedly reload?

CodePudding user response:

M_progress. Invalidate ();
Put in the for

CodePudding user response:

reference 1st floor schlafenhamster response:
m_progress. Invalidate ();
Put the for the


Put that in the for loop? I didn't write the outermost layers of the loop?

M_progress. SetRange (0, 100);

While (1)
{
M_progress. Invalidate ();
M_progress. SetPos (0);
int i=1;
for (; I & lt;=100; I++)
{
M_progress. SetPos (I);
}

}

Should not be like this? Why don't the progress bar move?

CodePudding user response:

M_progress. SetPos (I); After reading to redraw
M_progress. Invalidate ();

CodePudding user response:

Add
M_progress. SetPos (I); After reading to redraw
M_progress. Invalidate ();
M_progress. UpdateWindow ();//can't update the interface in the loop!

CodePudding user response:

I set the progress bar is usually don't need to update,
As long as set up setpos location will update the progress bar himself,

CodePudding user response:

Loop blocked message ring, you can RedrawWindow mandatory update
 
for(int i=0; i<=100; I++)
{
PCtrl - & gt; SetPos (I);
PCtrl - & gt; RedrawWindow ();
}


CodePudding user response:

Blocked, had better be message processing progress inside,

CodePudding user response:

Your m_progress. SetPos () operation on the OnTimer (),
  • Related