WinForms 工具提示项目尺寸适合
我正在使用 Toolstrip 为自己绘制一个 TabStrip,我不希望项目溢出,而是缩小以适应可用宽度。非常类似于许多浏览器选项卡的行为(例如 Chrome)。
我知道有一个可以覆盖的 LayoutEngine 属性,但我不知道如何实现它。
有人知道如何使物品适合工具条宽度吗?
I am using a Toolstrip to draw myself a TabStrip where I do not want the items to overflow, but rather shrink-to-fit the available width. Very much like many browsers tabs behave (ex. Chrome).
I know there is a LayoutEngine property which can be overriden, but I have no clue on how to implement this.
Anyone knows how to make the items fit the toolstrips width?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Infragistics .NetAdvantage WinToolbars 控件将执行此操作。这是一种商业产品,但购买控件可能比自己构建控件更便宜。
The Infragistics .NetAdvantage WinToolbars controls will do this. This is a commercial product, but it may be cheaper to buy a control than build one yourself.
看一下这个相关问题:
How to make a ToolStripComboBox to fill all the available space on a ToolStrip?
我更喜欢 Martin 的答案,因为它没有任何神奇的硬编码数字。虽然如果您要缩小多个项目,您仍然需要进行一些算术运算,但我确信相同的方法也适用。
Have a look at this related question:
How to make a ToolStripComboBox to fill all the space available on a ToolStrip?
I prefer Martin's answer because it doesn't have any magic hard-coded numbers in it. While you'll still have to do a bit of arithmetic if you are making multiple items shrink-to-fit, I'm sure the same method would be applicable.