Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
451 views
in Technique[技术] by (71.8m points)

.net - Best approach to Windows Forms rolling log output in 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.

Any ideas on the best Control to do a rolling log window in Windows Forms?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...