Tabcontrol,vb.net,选项卡按钮鼠标悬停样式
我有一个带有 tabcontrol 的 vb.net windows 窗体项目。
有人知道当您将指针悬停在标签页标题或“按钮”上时如何更改其样式吗?
我想您可以通过以下方式更改颜色:
TabControl1.SelectedTab.BackColor = Color.Black
但不确定如何将鼠标悬停到悬停在选项卡标题/按钮上。
I have a vb.net windows forms project with a tabcontrol.
Anyone know how to change the style of the tabpage title or "button" when you hover over it with the pointer ?
I guess you can change the colours with:
TabControl1.SelectedTab.BackColor = Color.Black
But not sure how to hook up the mouseover to the hovered over tab title/button.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想更改选项卡页(即带有选项卡内容的区域)的颜色,很容易做到,如下所示。
但是,如果要更改选项卡按钮,则需要将 TabControl1 DrawMode 设置为 TabDrawMode.OwnerDrawFixed,然后处理 DrawItem 事件。
If you want to change color of the tab page (i.e. area with tab content), it is very easy to do as shown below.
However, if you want to change tab button, then you need to set TabControl1 DrawMode to TabDrawMode.OwnerDrawFixed and then handle DrawItem event.
TabControl 内置了此功能的基本形式。尝试设置
HotTrack = True
。当您将鼠标悬停在选项卡上时,它将更改文本颜色。The TabControl has a basic form of this functionality built in. Try setting
HotTrack = True
. When you mouseover the tab, it will change text colour.