/// <summary>
        ///  TextBox根据文本长度自动扩大宽度
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            Graphics g = this.textBox1.CreateGraphics();
            System.Drawing.SizeF s = g.MeasureString(this.textBox1.Text, this.textBox1.Font);
            this.textBox1.Width = (int)s.Width + 3;
        }

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
  • 2022-12-23
  • 2021-09-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-18
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案