如何在c#.net windows应用程序中显示进度条,同时进程很长 [英] how to display progress bar in c#.net windows Application, while long process

查看:66
本文介绍了如何在c#.net windows应用程序中显示进度条,同时进程很长的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在c#windows应用程序中长时间显示进度条,任何人都可以帮助

I would like to display progress bar in long process in c# windows application, can anyone help

推荐答案

您可以使用线程更新进度条。





.NET包含一个名为 BackgroundWorker ,它提供了报告事件中后台线程进度的方法。在创建BackgroundWorker的线程(通常是UI线程)上自动调用该事件。



订阅ProgressChanged事件,并更新进度条那个事件处理程序官方MSDN文档提供了一些示例代码。





来源:

从另一个线程和类中更新C#Gui中的进度条 [ ^ ]
You can update your progress bar with threading.


.NET Includes a class called the BackgroundWorker, which provides methods for reporting the progress of the background thread in an event. The event is automatically called on the thread which created the BackgroundWorker (typically, the UI thread).

Subscribe to that "ProgressChanged" event, and update the progress bar in that event handler. The official MSDN Documentation provides some sample code.


Source:
Updating a progress bar in a C# Gui from another thread and class[^]


这篇关于如何在c#.net windows应用程序中显示进度条,同时进程很长的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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