实现效果:

  使Button控件大小自动适应文本长度

知识运用:

  按钮的AutoSize属性  //获取或设置一个值 以指示按钮是否基于其内容调整大小

  public override bool AutoSize{get;set;}

实现代码:

        private void button2_Click(object sender, EventArgs e)
        {
            this.button1.AutoSize = true;
            this.button1.Text = textBox1.Text;
        }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
  • 2022-12-23
  • 2021-09-18
  • 2022-12-23
猜你喜欢
  • 2021-07-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-06
  • 2022-12-23
  • 2021-09-29
  • 2022-12-23
相关资源
相似解决方案