jeffshumphreys / filmcab

A film collector's management system

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Colorize RichText log box

jeffshumphreys opened this issue · comments

I think things running, line could be italics, when done, go back to normal, and new line is bold saying complete.
Show time on right in green while running. gray when done.

var box = new RichTextBox
{
Dock = DockStyle.Fill,
Font = new Font("Courier New", 10)
};

box.AppendText("[" + DateTime.Now.ToShortTimeString() + "]", Color.Red);
box.AppendText(" ");
box.AppendText(userid, Color.Green);
box.AppendText(": ");
box.AppendText(message, Color.Blue);
box.AppendText(Environment.NewLine);

    box.SelectionStart = box.TextLength;
    box.SelectionLength = 0;

    box.SelectionColor = color;
    box.AppendText(text);
    box.SelectionColor = box.ForeColor;

Oops. above doesn't convert directly to Powershell

    $RunningActivityLog.SelectionStart = $RunningActivityLog.TextLength
    $RunningActivityLog.SelectionLength = 0
    $RunningActivityLog.SelectionColor = $textColor
    $RunningActivityLog.AppendText("$logtimestr`:$msg$([System.Environment]::NewLine)")
    $RunningActivityLog.ScrollToCaret()
    $RunningActivityLog.Refresh()