如何从“Grip”中回收空间?
我有一个带有单个 ToolStripStatusLabel、Spring=true 和通知背景色的 StatusStrip。
问题是状态栏右侧有一个丑陋的灰色方块。摆弄了一段时间后,我意识到这是调整手柄大小(我设置为 SizingGrip=false,GripStyle=Hidden)。然而,即使它被隐藏起来,它仍然占据着空间。我无法将状态条上的任何内容一直延伸到右侧。
您将如何解决这个问题?注意我不能只设置 StatusStrip 的背景色,因为 Status Label 会改变颜色并具有一些褪色效果。
I've got a StatusStrip with a single ToolStripStatusLabel, Spring=true and a background color for notifications.
The problem is that there's an ugly gray square on the right side of the status strip. After fiddling for a while, I realized this is the sizing grip (I had is set to SizingGrip=false, GripStyle=Hidden). Yet even with it hidden, it still hogs the space. I can't get any content on the status strip to extend all the way to the right.
How would you work around this? Note I can't just set the backcolor of the StatusStrip because the Status Label changes colors and has some fading effects.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
StatusStrip.Padding 属性已失效,如果禁用大小调整夹点,它会返回错误的 Padding.Right 值。您可以在表单构造函数中修复它,如下所示:
使用 Left 属性指定 Right 即可修复。不要费心将此错误提交给 Connect,他们不会修复它。
The StatusStrip.Padding property is borked, it returns the wrong value for Padding.Right if the sizing grip is disabled. You can fix it in your form constructor, like this:
Using the Left property to specify Right is the fix. Don't bother submitting this bug to Connect, they won't fix it.
查看此博客MSDN 上的条目。问题是关于手动更改大小调整手柄的大小,我认为按照建议使用 ToolStrip 渲染器也可以为您工作。
到目前为止,我遇到的问题是它删除了 StatusStrip 中状态标签上的背景颜色,因此这还不是解决方案,但它是一个开始。
Have a look at this blog entry on MSDN. The question was about changing the size of the sizing grip manually, and I think using the ToolStrip Renderer as suggested could work for you also.
The problem I have so far, is that it removes the background color on a status label in the StatusStrip, so it's not a solution yet, but it's a start.
我遇到了以下问题:当我设置 tsslSeparator.Spring = true 时,我的右侧标签在 tsslSeparator 失去焦点后立即消失。启用调整握点大小时会出现此问题。当它被禁用时,一切都工作得很好。
解决方案是将右标签的右边距设置为不同于 0 的值。
希望这对某人有帮助。
I had following problem: when I set
tsslSeparator.Spring = true
, my right label disappeared immediately after tsslSeparator lost focus. The issue appeared when sizing grip was enabled. When it was disabled, everything worked just fine.The solution was to set right margin for right label to something different than 0.
Hope this helps somebody.
如果微软对修复它不感兴趣,似乎正确的修复应该处理所有方向,并且理想情况下修复所有状态条(请参阅我对 获取所有子项,了解 GetAllChildren 的定义)
If Microsoft isn't interesting in fixing it, it seems like a proper fix should handle all orientations, and ideally fix all Status Strips (see my answer to Get All Children for definition of GetAllChildren)
我尝试过这个:
它对我有用。
I tried this:
It works for me.