ListView ColumnHeaders 的背景颜色

发布于 2024-07-26 22:00:51 字数 47 浏览 2 评论 0原文

有没有办法设置ListView的ColumnHeaders的BackColor?

Is there a way to set the BackColor of the ColumnHeaders of a ListView?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

断念 2024-08-02 22:00:51

我假设您在这里谈论的是 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).

蓝咒 2024-08-02 22:00:51

您需要覆盖 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)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文