StatusStrip 标签中的自动省略?
我正在编写一个 Windows 窗体应用程序,它有一个 StatusStrip,可以向用户显示状态信息,并在鼠标悬停在相关内容上时提供提示。但是,当程序处于最小窗口大小时,文本有时比整个 StatusStrip 还要大,并且标签会消失。必须有一个解决方法,理想情况下,当文本大于窗口允许的大小时,我希望它自动省略。但如何呢?
预先感谢 =)
I'm coding a Windows Forms App that has a StatusStrip that displays status informations to the user, and hints when the mouse is over relevant things. However, when the program is on it's minimal window size, the text sometimes is bigger than the whole StatusStrip, and the label simply dissapears. There must be a workaround to this, ideally I'd like it to auto ellipsis when the text is bigger than the window allows. But how?
Thanks in advance =)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Set TextAlign = MiddleLeft
Set Spring = True
这样你不会得到省略号,但它也不会消失。
如果您想要椭圆形,您可能必须实际测量宽度,并相应地调整文本。这不是一件容易的事。
Set TextAlign = MiddleLeft
Set Spring = True
You won't get ellipses this way, but it won't disappear either.
If you want ellipses you may have to actually measure the width, and adjust your text accordingly. Not an easy task.
您的消息很旧,但由于我遇到了同样的问题,因此我在这里发布了我找到的解决方案。
我使用该实用程序类:
用法(ToolStripStatusLabel):
用法(标签):
Your message is old, but as I had the same problem, I post here the solution I found.
I use that utility class :
Usage (ToolStripStatusLabel) :
Usage (Label) :