Change the Textbox height?

后端 未结 21 2243
心在旅途
心在旅途 2020-12-09 07:24

How do I change the height of a textbox ?

Neither of the below work:

this.TextBox1.Size = new System.Drawing.Size(173, 100);
         


        
21条回答
  •  情深已故
    2020-12-09 07:52

    AutoSize, Minimum, Maximum does not give flexibility. Use multiline and handle the enter key event and suppress the keypress. Works great.

    textBox1.Multiline = true;
    
     private void textBox1_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.KeyCode == Keys.Enter)
                {
                    e.Handled = true;
                    e.SuppressKeyPress = true;
                }
            }
    

提交回复
热议问题