44 lines
990 B
C#
44 lines
990 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.IO;
|
|
using System.Windows.Forms;
|
|
|
|
namespace BCG
|
|
{
|
|
class RichTextBoxStreamWriter : TextWriter
|
|
{
|
|
private RichTextBox myOutput;
|
|
|
|
public RichTextBoxStreamWriter (RichTextBox output)
|
|
{
|
|
myOutput = output;
|
|
}
|
|
|
|
public override void Write (char value)
|
|
{
|
|
//base.Write (value);
|
|
//myOutput.AppendText (value);
|
|
//myOutput.SelectionStart = myOutput.TextLength - 1;
|
|
//myOutput.ScrollToCaret ();
|
|
|
|
MethodInvoker action = delegate
|
|
{
|
|
//// this is too slow to live.
|
|
//myOutput.AppendText (value.ToString ());
|
|
//myOutput.SelectionStart = myOutput.TextLength - 1;
|
|
//myOutput.ScrollToCaret ();
|
|
};
|
|
|
|
myOutput.BeginInvoke (action);
|
|
|
|
}
|
|
|
|
public override Encoding Encoding
|
|
{
|
|
get { return Encoding.UTF8; }
|
|
}
|
|
}
|
|
}
|