首页 > 解决方案 > 我可以在 listviewitem 子项中加粗一个单词吗?

问题描述

我可以在列表视图中做这样的事情吗?
1 | 富 | 酒吧12 | x |
2 | 富 | 32酒吧| 是 |

在这种情况下,我想加粗特定的单词“bar”。
是否可以在列表视图中使用,或者是否有任何替代方法可以使其工作?

标签: vb.netwinforms

解决方案


这可能对你有用...

    Dim item1 As New ListViewItem
    item1.Text = "Item 1 BOLD"
    item1.UseItemStyleForSubItems = False      'Set this to FALSE to allow changing the subitem font. It is TRUE by default.
    item1.Font = New Font(ListView1.Font, FontStyle.Bold)
    item1.SubItems.Add("Sub Item Normal")
    item1.SubItems(1).Font = New Font(ListView1.Font, FontStyle.Regular)

    ListView1.Items.Add(item1)

推荐阅读