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

标签 c# winforms visual-studio-2010

如何设置 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/

相关文章:

visual-studio - 安装失败 : Visual Studio 2010 Pro installation

asp.net - ExpectedResponseUrl 错误是 Visual Studio 2010 web 性能测试

visual-studio-2010 - 部署包中每个人的默认设置

c# - C# .NET 位图的最大分辨率是多少?

c# - Monogame Vertex Buffer 行为怪异

c# - 如果是存储过程,我应该如何让我的 mockContext.Setup 返回?

c# - 如何取消通过数据绑定(bind)所做的更改?

c# - 在 C# 中减慢动画速度

c# - 如何根据单选按钮使同一图像的多种分辨率可用?

c# - 如何在编辑 DataGridView 单元格周围绘制边框?