ListView ColumnHeaders 的背景颜色
有没有办法设置ListView的ColumnHeaders的BackColor?
Is there a way to set the BackColor of the ColumnHeaders of a ListView?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我假设您在这里谈论的是 Windows。 AFAIK,标题背景颜色是由系统决定的,因为ListView是一个公共控件。
您也许可以自行绘制标题。 如果您使用 .NET,您可能想要实现一个
DrawColumnHeader
事件,但您必须拥有绘制整个控件(即项目)的能力。I assume you're talking about Windows here. AFAIK, the header background color is determined by the system, as the ListView is a common control.
You might be able to owner-draw the header. If you're using .NET, there's a
DrawColumnHeader
event that you might want to implement, but you'd have to owner draw the entire control (i.e. the items as well).您需要覆盖 WM_CTLCOLOR 消息,因为我现在不知道您在使用什么( MFC、C#)我无法向您提供更多详细信息。
对于 C#,请查看此(CodeProject:自定义标头ListView 中的控件)
You need to override the WM_CTLCOLOR message, now since I don't know what are you using (MFC, C#) I cannot give you any more details.
For C# take a look at this (CodeProject: Customizing the header control in a ListView)