using System; using System.Text; using System.IO; using System.Windows.Forms; namespace go01 { public class TextBoxStreamWriter : TextWriter { RichTextBox _output = null; public TextBoxStreamWriter(RichTextBox output) { _output = output; } public override void Write(char value) { base.Write(value); _output.AppendText(value.ToString().Replace('\n', ' ')); } public override Encoding Encoding { get { return System.Text.Encoding.UTF8; } } } }