如何在使用richtextbox loadfile或其他方法时显示进度 [英] How to show progress when use richtextbox loadfile or other methods

查看:82
本文介绍了如何在使用richtextbox loadfile或其他方法时显示进度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个richtextbox功能,我想显示加载文件的进度。

i尝试了其他方法,例如:

1. File.ReadAllText

2. StreamReader.ReadToEnd

3. StreamReader.ReadLine

4. richtextbox.LoadFile

但它无法显示进度。

显然,我测试加载时间,读取文件数据的一行是最慢的方法,我必须考虑加载的速度。

怎么实现我的purpuse,请回答。



备注:这是c#winform应用程序



我尝试过:



创建一个线程,并计算richtextbox.text.leng / FileInfo(filepathe).Length。

但是我无法显示进度

解决方案

使用 ProgressBar类(System.Windows.Forms) [ ^ ]。

there's a richtextbox compenent,I want to show the progress of the load file.
i tried other method such as:
1. File.ReadAllText
2. StreamReader.ReadToEnd
3. StreamReader.ReadLine
4. richtextbox.LoadFile
but it cann't show progress.
And, obviously, I test the loading time, one line of reading the file data is the slowest method, I have to take into account the speed of loading.
how to achieve my purpuse,tks for answer.

remark:it's c# winform application

What I have tried:

create a thread,and calculate richtextbox.text.leng/FileInfo(filepathe).Length.
but i cann't show progress

解决方案

Use a ProgressBar Class (System.Windows.Forms)[^].


这篇关于如何在使用richtextbox loadfile或其他方法时显示进度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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