W
wasishincar
Hi there,
I'm working on a stress test tool for drawing. After start button
clicked, it fires Form_Paint(xxx) event handler to continuous drawing
shapes on screen. Problem is once there is a while loop in the event
handler, so once entering the loop, no other event can capture from
application.
I tried to use a thread but it causes another problem that e.Graphics
will be out of scope, and raise an exception.
Below is my brief of my code. Could any one tell me how to make solve
this problem? Thanks.
private bool bTesting;
private void drawPage(Graphics g)
{
// do something draw...
}
private void Form_Paint(Object sender, PaintEventArgs e)
{
// skip
while(this.bTesting)
{
drawPage(e.Graphics);
}
}
I'm working on a stress test tool for drawing. After start button
clicked, it fires Form_Paint(xxx) event handler to continuous drawing
shapes on screen. Problem is once there is a while loop in the event
handler, so once entering the loop, no other event can capture from
application.
I tried to use a thread but it causes another problem that e.Graphics
will be out of scope, and raise an exception.
Below is my brief of my code. Could any one tell me how to make solve
this problem? Thanks.
private bool bTesting;
private void drawPage(Graphics g)
{
// do something draw...
}
private void Form_Paint(Object sender, PaintEventArgs e)
{
// skip
while(this.bTesting)
{
drawPage(e.Graphics);
}
}