-1

I want to create a colored border around a TextBox on a Windows Form, something like what can be done in Android (with the "ID" and "PackSize" EditText widgets):

enter image description here

Is this possible (without writing a gazillion LOC and sacrificing a chicken)?

There is a BorderStyle property, but that does not change the color of the border. The ForeColor and BackColor properties also do nothing helpful.

B. Clay Shannon-B. Crow Raven
  • 8,547
  • 144
  • 472
  • 862
  • possible duplicate of http://stackoverflow.com/questions/9768938/change-the-bordercolor-of-the-textbox – quantdev May 29 '14 at 22:23
  • 1
    Three words: W P F. Customizing basic Winforms controls has never been easy or recommended. In WPF, it's a breeze. – Nathan A May 29 '14 at 22:23
  • 1
    It's an old question but I believe here is the [correct way](http://stackoverflow.com/a/39420512/3110834) of doing what you were looking for. Also [this one](http://stackoverflow.com/a/38405319/3110834) may be useful for change border color on focus. – Reza Aghaei Sep 14 '16 at 12:54

1 Answers1

1

You could either:

  1. Put the textbox in a slightly larger Panel with a dark BackColor or
  2. Handle the Paint event and draw the border yourself.
adv12
  • 8,443
  • 2
  • 24
  • 48
  • 2. : The TextBox doesn't have a Paint event, so it would have to be the Form's. Not a big problem, just worth mentioning. – TaW May 30 '14 at 10:50