aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/Controls/TerminalBox.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-03-09 16:46:34 -0500
committerMichael <[email protected]>2017-03-09 16:46:34 -0500
commit251521835b60024dec292a759d738e2b81bf1417 (patch)
treeeb9a943b9a365e51bc25843168c6a301e2316783 /ShiftOS.WinForms/Controls/TerminalBox.cs
parent3f08cb807c1490af423450e3eb03a46aa11caf2f (diff)
downloadshiftos_thereturn-251521835b60024dec292a759d738e2b81bf1417.tar.gz
shiftos_thereturn-251521835b60024dec292a759d738e2b81bf1417.tar.bz2
shiftos_thereturn-251521835b60024dec292a759d738e2b81bf1417.zip
Console colors!
Diffstat (limited to 'ShiftOS.WinForms/Controls/TerminalBox.cs')
-rw-r--r--ShiftOS.WinForms/Controls/TerminalBox.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/Controls/TerminalBox.cs b/ShiftOS.WinForms/Controls/TerminalBox.cs
index 7c0da57..9e4c61c 100644
--- a/ShiftOS.WinForms/Controls/TerminalBox.cs
+++ b/ShiftOS.WinForms/Controls/TerminalBox.cs
@@ -24,6 +24,7 @@
using System;
using System.Collections.Generic;
+using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
@@ -56,16 +57,31 @@ namespace ShiftOS.WinForms.Controls
{
this.HideSelection = true;
this.Select(this.TextLength, 0);
+ this.SelectionFont = ConstructFont();
this.SelectionColor = ControlManager.ConvertColor(ConsoleEx.ForegroundColor);
this.SelectionBackColor = ControlManager.ConvertColor(ConsoleEx.BackgroundColor);
this.AppendText(Localization.Parse(text));
this.HideSelection = false;
}
+ private Font ConstructFont()
+ {
+ FontStyle fs = FontStyle.Regular;
+ if (ConsoleEx.Bold)
+ fs = fs | FontStyle.Bold;
+ if (ConsoleEx.Italic)
+ fs = fs | FontStyle.Italic;
+ if (ConsoleEx.Underline)
+ fs = fs | FontStyle.Underline;
+
+ return new Font(this.Font, fs);
+ }
+
public void WriteLine(string text)
{
this.HideSelection = true;
this.Select(this.TextLength, 0);
+ this.SelectionFont = ConstructFont();
this.SelectionColor = ControlManager.ConvertColor(ConsoleEx.ForegroundColor);
this.SelectionBackColor = ControlManager.ConvertColor(ConsoleEx.BackgroundColor);
this.AppendText(Localization.Parse(text) + Environment.NewLine);