将 WinForms TextBox 更改为 BorderStyle.None 会导致文本被截断 [英] Changing WinForms TextBox to BorderStyle.None causes text to be cut off

查看:25
本文介绍了将 WinForms TextBox 更改为 BorderStyle.None 会导致文本被截断的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将 WinForms TextBox 控件更改为没有边框.

i've changed a WinForms TextBox control to have no border.

当我这样做时,框中文本的底部像素行被切断.

When i do the bottom pixel row of text in the box is being cut off.

顶部: BorderStyle.Fixed3D(默认).底部: BorderStyle.None

可以看到无边框文本框的最后一段文字被截断了:

You can see the last bit of text in the un-bordered text box is cut off:

我如何说服 TextBox(他的身高不能改变),它需要更高?

How do i convince a TextBox (who's height cannot be changed), that it needs to be taller?

推荐答案

AutoSize 属性就在那里,只要继承自 TextBox 就可以得到该属性:

The AutoSize property is there, just inherit from TextBox and you can get to the property:

public class TextBoxEx : TextBox {

  public TextBoxEx() {
    base.AutoSize = false;
  }

}

这篇关于将 WinForms TextBox 更改为 BorderStyle.None 会导致文本被截断的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆