title: How to set location of cursor in Textbox
body: <p>I am making a height-adjustable and vertically alignable textbox with following code. The reason why I should do this is because although I can make winform textbox height-adjustable, I still can't vertically align the text in the textbox. So I decided I have to draw the text OnPaint event. The textbox is showing correct alignment now, but cursor is still located on top of textbox. Is there any way to control this position as well?</p>
  
  <pre><code>public class TextBoxHeightAdjustable : System.Windows.Forms.TextBox
  {
  
      public TextBoxHeightAdjustable()
      {
          this.AutoSize = false;
          this.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
          this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true);
      }
      protected override void OnPaint(PaintEventArgs e)
      {
          // This never runs no matter what I try!
          base.OnPaint(e);
          // Create a StringFormat object with the each line of text, and the block 
          // of text centered on the page.
          StringFormat stringFormat = new StringFormat();
          stringFormat.Alignment = StringAlignment.Center;
          stringFormat.LineAlignment = StringAlignment.Center;
  
          e.Graphics.DrawString(Text, Font, new SolidBrush(ForeColor), ClientRectangle, stringFormat);
      }
  }
  </code></pre>