Skip to content

Instantly share code, notes, and snippets.

@jpluimers
Last active December 22, 2015 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpluimers/6392029 to your computer and use it in GitHub Desktop.
Save jpluimers/6392029 to your computer and use it in GitHub Desktop.
When ForeColor = Color.Red gets displayed as SystemColors.WindowText...
using System;
using System.Drawing;
using System.Windows.Forms;
namespace ChartWindowsFormsApplication
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
textBox1.ReadOnly = false;
textBox2.ReadOnly = true;
SetTextBoxForeColorAndText(textBox1);
SetTextBoxForeColorAndText(textBox2);
}
private void SetTextBoxForeColorAndText(TextBox textBox)
{
textBox.ForeColor = Color.Red;
textBox.Text = String.Format("ForeColor={0}, BackColor={1}", textBox.ForeColor, textBox.BackColor);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment