C#,文本框中的文本或文本在文本框中缩小 [英] C# ,The text in the Text Box or texts are shrink in the text box

查看:118
本文介绍了C#,文本框中的文本或文本在文本框中缩小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人

我是C#的新程序,当我在文本框中键入字母时,这些字母不会超出文本框的范围,并且字母的高度不会重新使用,但是这些字母会在文本框中缩小.

请帮助我,谢谢

Dear all

i am new program to C#, When i type letters in the textbox the letters not goto outof textbox bounds and the letters height not redused, but the letters are shrink with in the textbox.

please help me, thanks

推荐答案

我认为您所描述的就是您所期望的.这不是TextBox的工作方式.没有简单的方法来实现此行为.可以将字体作为TextBox的内容进行操作,但是几乎不可能调整所需的字体大小,因为由于文本呈现的复杂性,精确的字符串大小度量非常不准确.

更重要的是,这种行为将使应用程序几乎无法使用.字母不应该缩水;这将使它们几乎不可见.只能通过用户的显式命令来更改字体.举一个很好的例子,看看现代版本的主要Web浏览器如何处理此问题.

—SA
I assume what you describe is what you expect. This is not how TextBox works. There is not a simple way to achieve this behavior. Manipulation of the font as contents of the TextBox is quite possible, but it''s nearly impossible to adjust required font size, as exact string size measure is pretty inaccurate, due to the complex nature of text rendering.

More importantly, such behavior would make application nearly unusable. Letters should not shrink; it would make them nearly invisible. The font should change only by explicit command from the user. For a good example, look how modern versions of major Web browser handle this.

—SA


如果希望文本框根据需要扩展或在键入时更改字体大小,则必须以编程方式进行.
If you want the TextBox to expand as needed or change the font size while typing, you will have to do that programatically.


这篇关于C#,文本框中的文本或文本在文本框中缩小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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