问题描述
在一个窗体应用程序我显示日志输出从生成大量输出的长时间运行的命令行应用程序。我启动该程序在后台运行,并捕获它的输出,目前显示它使用AppendText一个文本框。我preFER只显示示例中的最后1000行。从文本框删除线是昂贵的,和一个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.
这篇关于最好的办法,以Windows窗体的文本框的滚动日志输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!