Last active
December 22, 2015 00:49
-
-
Save jpluimers/6392029 to your computer and use it in GitHub Desktop.
When ForeColor = Color.Red gets displayed as SystemColors.WindowText...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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