gpt4 book ai didi

c# - 如何在 ListView 中为特定列设置字体颜色?

转载 作者:太空宇宙 更新时间:2023-11-03 11:14:16 25 4
gpt4 key购买 nike

如何在 ListView 中设置特定列的字体颜色?我在 ListView 中有两列,我想将第二列中的字体设置为红色。

最佳答案

使用ListView.DrawColumnHeader事件

private void listView1_DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)
{
// Draw the header text.
using (Font headerFont =
new Font("Helvetica", 10, FontStyle.Bold, FontColor.Red))
{
e.Graphics.DrawString(e.Header.Text, headerFont,
Brushes.Black, e.Bounds, sf);
}
}

关于c# - 如何在 ListView 中为特定列设置字体颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13151608/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com