tabcontrol owndraw 改变 tabcontrol 的边框样式
我遇到了 tabcontrol 的问题。 当我将 DrawMode 更改为 ownderdrawfixed 时,tabcontrol 的 borderstyle 从“fixedsingle”更改为“3dfixed”,但 tabcontrol borderstyle 没有这样的属性。与tabcontrol的borderstyle最接近的是外观没有改变。
看看上面的图片就明白我在说什么了。
有没有什么方法可以在不使用ownerdraw的情况下更改标签页标题的颜色,这样我就不必使用ownerdraw?
或者如何修复选项卡控件的边框样式?
I got a problem with tabcontrol.
When I change the DrawMode to ownderdrawfixed, the borderstyle of the tabcontrol changes from "fixedsingle" to "3dfixed" but there's no such a property of tabcontrol borderstyle. the closest thing to borderstyle of tabcontrol is the appearance which didnt change.
look at the picture above to understand what I am talking about.
is there any way to change to color of the tabpage title without ownerdraw so I will not have to use ownerdraw?
or how can I fix the borderstyle of the tabcontrol?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您将控件设置为 Ownerdraw 时,您具体是在说“我将处理该控件的所有绘图”。这会完全禁用视觉样式渲染。
为了呈现具有视觉样式的控件,您需要使用
System.Windows.Forms.VisualStyles
命名空间。它需要大量代码,但你却说你想自己处理这一切。我将从VisualStyleRenderer
- 您需要调用它,并传递VisualStyleElements
进行渲染。另请参阅有关树视图 Ownerdraw 的问题:VisualStyleRenderer 和主题 (WinForms)
When you set a control to ownerdraw, you are specifically saying "I will handle all drawing for this control". This disables the visual styles rendering completely.
In order to render a control with visual styles, you'll need to use the facilities found in the
System.Windows.Forms.VisualStyles
namespace. It requires a good bit of code, but then you are saying you want to handle it all yourself. I'd start with the examples forVisualStyleRenderer
- You'll need to call it, passingVisualStyleElements
to render.See also this question about treeview ownerdraw: VisualStyleRenderer and themes (WinForms)