当调用并运行进度条时,它会在父活动上留下标记/补丁。 [英] When progress bar is invoked and run, it leaves a mark/patch on parent activity.

查看:67
本文介绍了当调用并运行进度条时,它会在父活动上留下标记/补丁。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个用C#.NET Visual studio开发的Windows应用程序,用它来创建食谱。

所以这里我在特定事件上调用进度条(winforms)的特定活动。一旦进度条启动并且正在进行,我碰巧在后台看到父活动上的一些绿色补丁。即使在进度条完成并关闭
后,这些补丁仍然会出现。一旦我点击食谱外的任何地方,在设计师窗口上说这些补丁就会消失。我无法找到如何不在第一时间出现这些补丁。

请指导解决方案。

I have a windows application developed in C# .NET Visual studio with which i create recipes.
So here on a particular activity I invoke a progress bar(winforms) on a particular event. Once the progress bar is up and progressing, I happened to see some green patches on the parent activity at the background. Even after the progress bar completes and closed those patches still appear. Once I  click anywhere outside the recipe, say on the designer window those patches disappear. I'm unable to find how not to make those patches appear in first place.
Please, guide me with pointers to solution.

谢谢!

推荐答案

当您显示进度条时,听起来好像在进行阻止呼叫。由于主UI被阻止,因此无法重新绘制,因此会出现损坏的窗口行为。理想的解决方案是将非UI相关工作移动到工作线程(例如,使用async / await或者也许是BackgroundWorker的
)。然后,您可以继续处理UI消息,这将允许您的UI根据需要进行重新绘制。

Sounds like you are making a blocking call when you display your progress bar. Since the main UI is blocked it cannot repaint and therefore you get the corrupt window behavior. The ideally solution is to move your non-UI related work to a worker thread (e.g. using async/await or perhaps BackgroundWorker). Then you can continue to process UI messages which will allow your UI to repaint as needed.

您提到的Activity让我相信您正在使用WWF。但你也提到了设计师。所以目前还不清楚你正在使用什么技术。如果你能澄清一下,那么我们可以将这篇文章移到一个更合适的帖子。

You mentioned Activity which leads me to believe you're using WWF. But you also mention the designer. So it is unclear what technology you're using. If you can clarify that then we can move this post to a more appropriate thread.

Michael Taylor

http://www.michaeltaylorp3.net

Michael Taylor
http://www.michaeltaylorp3.net


这篇关于当调用并运行进度条时,它会在父活动上留下标记/补丁。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆