實現效果:

知識運用:
按鈕的AutoSize屬性 //獲取或設置一個值 以指示按鈕是否基於其內容調整大小
public override bool AutoSize{get;set;}
實現代碼:
private void button2_Click(object sender, EventArgs e)
{
this.button1.AutoSize = true;
this.button1.Text = textBox1.Text;
}
