#339 – 是按钮上的文字换行显示(Wrapping a Button’s Text Content to Multiple Lines)
2016-10-11 17:01
615 查看
当Button 控件的大小是根据内容自适应的时候,它的大小将根据内容调整为完全显示说有文字,但是这样显示的文字只用一行显示。
但是如果你限制了按钮的宽度,有可能有些文字会被截断。
想要按钮上的文字自动换行,可以使用TextBlock 来显示按钮的文字来实现。你需要设置TextBlock 的TextWrapping 属性。
<Button HorizontalAlignment="Center" VerticalAlignment="Center"
Margin="10" Width="120">
<TextBlock Text="Click me if you want to see something cool. In fact, click as many times as you like."
TextWrapping="Wrap"/>
</Button>
原文地址:https://wpf.2000things.com/2011/07/11/339-wrapping-a-buttons-text-content-to-multiple-lines/
<Button Content="Click me if you want to see something cool. In fact, click as many times as you like." HorizontalAlignment="Center" VerticalAlignment="Center"
但是如果你限制了按钮的宽度,有可能有些文字会被截断。
想要按钮上的文字自动换行,可以使用TextBlock 来显示按钮的文字来实现。你需要设置TextBlock 的TextWrapping 属性。
<Button HorizontalAlignment="Center" VerticalAlignment="Center"
Margin="10" Width="120">
<TextBlock Text="Click me if you want to see something cool. In fact, click as many times as you like."
TextWrapping="Wrap"/>
</Button>
原文地址:https://wpf.2000things.com/2011/07/11/339-wrapping-a-buttons-text-content-to-multiple-lines/
相关文章推荐
- Python3 Tkinter基础 Button text,fg在窗体中添加一个按钮,在按钮上显示文字 并 设置文字的颜色
- 带背景显示文字,自动换行的MultipleTextView
- 点击按钮后禁止按钮并显示文字[正在处理...], getelementbyid button标签 text 赋值
- Python3 Tkinter基础 Button Label Frame 单击按钮,Label中显示的文字更换 StringVar textvariable
- jquery中当text文本框为空时,button按钮是disabled状态,否则为enable状态且输入框只能输入数字。并用alert显示第一个数字
- input:button按钮文字换行
- 浏览器兼容CSS代码:按钮文字垂直居中(input button text vertical align)
- 浏览器兼容CSS代码:按钮文字垂直居中(input button text vertical align)
- TextView 显示某几个文字后突然想换行
- Page directive: illegal to have multiple occurrences of contentType with different values (old: text
- 监听EditText输入状态,根据是否有输入内容显示ImageButton(清空按钮)
- TextBlock中显示文字和图片,且不会自动换行
- 1怎样让输入的text文本填写的部分只添加数字、2怎样将输入的数字一次性全部删除 3怎样选择密码 让它不显示 4 怎样实现在没有return的情况下点击button的情况下就能够使键盘页面下落5 怎样实现点击指定的button来对使指定的text进行键盘弹出 6怎样改变button按钮的状态
- 浏览器兼容CSS代码:按钮文字垂直居中(input button text vertical align)
- 用9path图片做背景 button和textview的文字不显示
- button按钮与文字链接显示效果一样
- 如何获取字符串的屏幕显示长度,以及在button上文字换行。
- 如何使带背景图片的Button按钮中的文字居中偏上显示
- 如何使带背景图片的Button按钮中的文字居中偏上显示
- illegal to have multiple occurrences of contentType with different values (old: text/html; charset=UTF-8, new: text/html; charset=utf-8)