简体   繁体   中英

window - C# Resize Form by Inputting in Textbox

private void txtCkInNumOcc_TextChanged(object sender, EventArgs e)
{
   int numocc = int.Parse(txtCkInNumOcc.text);

   if(numocc > 1)
   {
      AddCheckIn checkin = new AddCheckIn();
      checkin.Height = 470;
   }
}

I like to resize my form to 470 if the textbox is greater than 1 without buttons.

use this.Height if you need to change the height of the current form

private void txtCkInNumOcc_TextChanged(object sender, EventArgs e)
{
   int numocc;

   if(int.TryParse(txtCkInNumOcc.text, out numocc) && numocc > 1)
   {
      this.Height = 470;
   }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM