如何删除 ToolStrip Winforms 控件一角的这种奇怪的视觉伪影?
这是显示问题的图片。看一下右下角。
有人知道如何摆脱它吗?
将 LayoutStyle
设置为 VerticalStackWithOverflow
可以修复此问题,但也会使项目水平居中,这是我不想要的。
我只想要一个如图所示的垂直堆栈,但右下角没有黑线。
Here is the picture that shows the problem. Take a look at the bottom right corner.
Anyone knows how to get rid of it?
Setting LayoutStyle
to VerticalStackWithOverflow
fixes it but also centers the items horizontally which I don't want.
I just want a vertical stack like in the pic, but without that black line in the bottom right corner.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
很抱歉参加聚会迟到,但接受的答案无法满足我的需求。以下解决方案是我想出的:
摆脱黑线
1)创建自定义渲染器:
2)使用自定义渲染器:
摆脱背景
上面的解决方案满足了原始问题的需要,但我没有'也不喜欢 ToolStrip 上的渐变背景。我希望 ToolStrip 成为一个“隐形”容器:
1)创建自定义颜色表:
2)使用自定义颜色表:
Sorry for being late to the party, but the accepted answer didn't work for my needs. The following solution is what I came up with:
Getting rid of the black line
1) Create a custom renderer:
2) Use the custom renderer:
Getting rid of the background
The above solution satisfies the need of the original question, but I didn't like the gradient background on the ToolStrip either. I wanted the ToolStrip to be an "invisible" container:
1) Create a custom color table:
2) Use the custom color table:
在属性栏中,将“RenderMode”设置为“System”或使用
执行此操作会将 .BackColor 更改为“Control”,但如果需要,您可以在之后更改。
In the properties bar, set "RenderMode" to "System" or use
Doing this will change the .BackColor to "Control" but you can change that after if you want.
我认为最好的办法是在属性中将
RenderMode
设置为System
,并将布局属性保留为HorizontalStackWithOverflow
。但前提是您不介意更改工具提示绘制样式。
I think your best shot would be to set the
RenderMode
toSystem
in the properties and leave the layout properties toHorizontalStackWithOverflow
.But that is if you don't mind changing the tooltip paint style.