无法在 C# 工具条控件中创建多行图标标题
我一直在尝试使用标准 C# 工具条控件将按钮文本格式设置为多行,但到目前为止我不得不承认失败。
我想要实现的是图片下方的文本,文本包裹固定的图标大小,而不是扩展图标大小以容纳文本,我不确定我是否可以更容易地解释它 - 目前,该程序如下所示:
Icon Image
Icon Text - extending icon
而我实际上希望它显示为这样:
Icon Image
Icon Text
Wrapped
Under Icon
我有点难以解释它比这更好,图标上没有多行属性,并且它们不接受标准 \n 转义强制换行。
我有一个可怕的想法,我需要创建一个自定义的toolstripbutton类才能做到这一点,但我完全不知道从哪里开始,所以非常感谢任何帮助!
预先感谢您的帮助:)
I've been trying and trying to get the standard C# toolstrip control to format button text as multiline, and so far I've had to admit defeat.
What I'm trying to achieve is text under the picture, and the text wrapping a fixed icon size, rather than extending the icon size to accommodate the text, I'm not sure if I can explain it any easier - at the minute, the program looks like the following:
Icon Image
Icon Text - extending icon
whereas I actually want it to display as such:
Icon Image
Icon Text
Wrapped
Under Icon
I'm a bit stuck as to explain it any better than that, there's no multiline property on icons, and they don't accept the standard \n escape to force a newline.
I've got a horrid thought that I'm going to need to create a custom toolstripbutton class in order to do this, but I'm at a complete loss as to where to begin with that, so any help is graciously appreciated!
Thanks in advance for any assistance :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以通过编程方式设置 ToolStripButton 的 Text 属性,如下所示:
在表单的构造函数中运行它。
当然,您还可以将 ToolStripButton 的
ImageTextRelation
属性设置为ImageAboveText
,并将其DisplayStyle
设置为ImageAndText
。You can programmatically set the Text property of the ToolStripButton like this:
Run this in your form's constructor.
Of course you'd also set your ToolStripButton's
ImageTextRelation
property toImageAboveText
and itsDisplayStyle
toImageAndText
.我使用此代码以两行显示文本属性;
I used this code to display the text property in two lines;