问题描述
在 Forms 应用程序中,我正在显示来自生成大量输出的长时间运行的命令行应用程序的日志输出.我在后台启动程序,捕获它的输出,当前使用 AppendText 在 TextBox 中显示它.例如,我更喜欢只显示最后 1000 行.从 TextBox 中删除行的成本很高,而且 TextBox 并不是滚动日志显示的最佳方法.
In a Forms application I'm displaying log output from a long running command-line application that generated a lot of output. I start the program in the background, and capture its output and currently display it in a TextBox using AppendText. I prefer to only display for example the last 1000 lines. Removing lines from a TextBox is expensive, and a TextBox does not really feels like the best approach for rolling log display.
关于在 Windows 窗体中执行滚动日志窗口的最佳控件有什么想法吗?
Any ideas on the best Control to do a rolling log window in Windows Forms?
推荐答案
我曾经让列表框做这种事情.如果行数达到 1000,您只需删除第一行.如果日志行太长,您可以使列表框更宽一些(取决于日志信息以及是否有可能从第一个可见的没有水平滚动的单词)并使水平滚动条可见.
I used to have listboxes do this kind of thing. You just remove the first line if the line count reaches, say, 1000. If the log line is too long, you could make the listbox a bit wider (depends on the log information and whether it's possible to catch the meaning from the first visible words without horizontal scrolling) and make the horizonal scrollbar visible.
这篇关于TextBox 中 Windows 窗体滚动日志输出的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)