如何定期更新显示图像? - C#

时间:2018-07-18 03:25:47

标签: c# multithreading graphics blocking display

我正在编写一个渲染分形图像的程序。生成这些图像需要花费时间,我想实时监视程序的进度。

这是我想象代码结构的结构:

// create a window to display the image as it gets rendered
CreateDisplayWindow();

// as long as you are not finished rendering the image,
while(!doneRendering)
{
    // render a bit more of the image.
    RenderASmallPartOfMyImage();
    // update the screen if it has been too long since the last time it was updated.
    if(timeSinceLastDisplayUpdate >= displayUpdatePeriod) UpdateDisplayWindow();
}

我已经在Google和MSDN上搜索了数小时,试图找到一种简单的方法来实现这一目标。我只找到复杂的答案。我想正确答案将非常简单。

总结我的问题:如何创建可以定期更新的“显示窗口”,而不会阻止我的while(!doneRendering)循环的执行?

0 个答案:

没有答案