如何防止在C#Windows窗体按钮中进行文本换行 [英] How to prevent text wrapping in C# Windows Form Button

查看:475
本文介绍了如何防止在C#Windows窗体按钮中进行文本换行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





如何在表格按钮上禁用文字换行..

如果我的文字很长而按钮宽度较小,它变成2行......

我不想要这个,,,我想要一行最后有一些截断的文字...

它怎么可能可能吗?

Hi,

How can I disable text wrapping on Form button..
If my text is long and button width is less, it becomes 2 lines....
I dont want this,,, I want 1 line with some truncated text at the end...
How can it be possible ?

推荐答案

设置按钮高度,使其只保留一行:23像素是正常的。如果有第二排空间,系统自动添加它和AFAIK,则无法关闭它。



另一种解决方案是使用图像的文字,但你必须小心分辨率,以避免文字看起来很麻烦,这不是一个很好的国际化解决方案。





你也可以处理Button.Paint事件并自己绘制字符串。

[/ edit]
Set the Button height so that it only holds a single row: 23 pixels is normal. If there is room for a second row, the system automatically adds it and AFAIK, there is no way to turn that off.

The other solution is to use an image of the text, but you will have to be careful with resolutions to avoid the text looking jaggy, and it isn't a good solution for internationalization.

[edit]
You could also handle the Button.Paint event and draw the string yourself.
[/edit]


这篇关于如何防止在C#Windows窗体按钮中进行文本换行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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