title: Drawing Rectangle as TextBox Border
body: <p>I'm using validation methods for my textboxes in a class named <code>Validators</code>. I'm trying also to draw a rectangle on the textbox which failed to validate.</p>
  
  <p>Im using this code:</p>
  
  <pre><code>    private void TextBoxStyle(TextBox textBox)
      {
          Graphics graphics = textBox.CreateGraphics();
          Pen redPen = new Pen(Color.Red);
  
          graphics.DrawRectangle(redPen, textBox.Location.X, textBox.Location.Y, textBox.Width, textBox.Height);
      }
  
      /// &lt;summary&gt;
      /// Validates TextBoxes for string input.
      /// &lt;/summary&gt;
      public bool ValidateTextBoxes(params TextBox[] textBoxes)
      {
          foreach (var textBox in textBoxes)
          {
              if (textBox.Text.Equals(""))
              {
                  Graphics graphics = textBox.CreateGraphics();
                  Pen redPen = new Pen(Color.Red);
  
                  graphics.DrawRectangle(redPen, textBox.Location.X, textBox.Location.Y, textBox.Width, textBox.Height);
  
                  return false;
              }
          }
  
          return true;
      }
  </code></pre>
  
  <p>The problem is... the rectangles wont show. Am I doing something wrong with the code ? If yes, help please.</p>