如何在CListCtrl中为单个项添加下划线

时间:2022-08-26 23:14:35

We want some items in a CListView to appear like hypertext links.

我们希望CListView中的某些项看起来像超文本链接。

I can make everything underlined by setting the lfUnderline flag in LOGFONT, and creating a font from this, before calling SetFont - but this applies to the whole CListView.

我可以通过在LOGFONT中设置lfUnderline标志并在调用SetFont之前从中创建字体来使所有内容都加下划线 - 但这适用于整个CListView。

Does anyone know how to make individual items in a CListView to appear underlined?

有谁知道如何使CListView中的单个项目显示下划线?

2 个解决方案

#1


You can do this by using the custom-draw notifications and modifying the font on the particular item you want within the custom-draw handler.

您可以通过使用自定义绘制通知并在自定义绘制处理程序中修改所需特定项目上的字体来执行此操作。

See this link for details.

请参阅此链接了解详情。

#2


Try this:

oMyCListView.SetExtendedStyle(LVS_EX_ONECLICKACTIVATE)

#1


You can do this by using the custom-draw notifications and modifying the font on the particular item you want within the custom-draw handler.

您可以通过使用自定义绘制通知并在自定义绘制处理程序中修改所需特定项目上的字体来执行此操作。

See this link for details.

请参阅此链接了解详情。

#2


Try this:

oMyCListView.SetExtendedStyle(LVS_EX_ONECLICKACTIVATE)