Skip to content

Instantly share code, notes, and snippets.

@jpluimers
Created October 2, 2013 06:51
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/6789916 to your computer and use it in GitHub Desktop.
Save jpluimers/6789916 to your computer and use it in GitHub Desktop.
using System;
using System.Drawing;
using System.Windows.Forms;
namespace BeSharp.Windows.Forms
{
public static class TextBoxBaseExtensions
{
public static void SetForeColorOnReadOnly(this TextBoxBase target, Color color)
{
target.ForeColor = color;
// http://stackoverflow.com/questions/276179/how-to-change-the-font-color-of-a-disabled-textbox/631983#631983
if (target.ReadOnly)
target.BackColor = target.BackColor;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment