How to change the height of textBox in VS

Beginners vs. When using the textBox control, you may encounter the problem that the height of the textBox cannot be changed. Here are several ways to modify the height of the textBox:
1. Change the Textbox to multi-line mode, set the MutliLine property to True, and then block the Enter key.
private void txtTest_KeyDown (object sender, KeyEventArgs e)
        {
            if ((int)e.KeyCode == 13)
            {
                e.SuppressKeyPress = true;
            }
        }
2. Change the font size in the property window and indirectly change the height of the
  Textbox Project, you can refer to: http://www.codeproject.com/KB/cs/SetTextBoxHeight.aspx
3. Keep the single-line mode, set AutoSize to false, and then set the height. The AutoSize property is hidden and needs to be set directly in the code
 txtTest.AutoSize = false;
            txtTest.Height = 18;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325019831&siteId=291194637