1、owerDraw 设置为true

2、实现事件

DrawColumnHeader

DrawItem

DrawSubItem

private void listView1_DrawColumnHeader(object sender, DrawListViewColumnHeaderEventArgs e)
{
int tColumnCount;
Rectangle tRect = new Rectangle();
Point tPoint = new Point();
Font tFont = new Font("宋体", FontSize, FontStyle.Regular);
SolidBrush tBackBrush = new SolidBrush(System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(255))))));
SolidBrush tFtontBrush;
tFtontBrush = new SolidBrush(System.Drawing.SystemColors.GradientActiveCaption);

if (listView1.Columns.Count == 0)
return;

tColumnCount = listView1.Columns.Count;
tRect.Y = 0;
tRect.Height = e.Bounds.Height - 1;
tPoint.Y = sWidth;
for (int i = 0; i < tColumnCount; i++)
{
if (i == 0)
{
tRect.X = 0;
tRect.Width = listView1.Columns[i].Width;
}
else
{
tRect.X += tRect.Width;
tRect.X += 1;
tRect.Width = listView1.Columns[i].Width - 1;
}
e.Graphics.FillRectangle(tBackBrush, tRect);
tPoint.X = tRect.X + sWidth;
e.Graphics.DrawString(listView1.Columns[i].Text, tFont, tFtontBrush, tPoint);
}

}

private void listView1_DrawItem(object sender, DrawListViewItemEventArgs e)
{
Point tPoint = new Point();
SolidBrush tFrontBrush = new SolidBrush(Color.Blue);
Font tFont = new Font("宋体", FontSize, FontStyle.Regular);
tPoint.X = e.Bounds.X + 3;
tPoint.Y = e.Bounds.Y + 2;
e.Graphics.DrawString(e.Item.Text, tFont, tFrontBrush, tPoint);
}

private void listView1_DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
{
Point tPoint = new Point();
SolidBrush tFrontBrush = new SolidBrush(Color.Blue);
Font tFont = new Font("宋体", FontSize, FontStyle.Regular);
tPoint.X = e.Bounds.X + 3;
tPoint.Y = e.Bounds.Y + 2;
e.Graphics.DrawString(e.SubItem.Text, tFont, tFrontBrush, tPoint);
}

转的: 重绘ListView 修改标题颜色的更多相关文章

  1. Android重绘ListView高度

    Android重绘ListView高度 经常会有这样需求,需要ListView默认将所有的条目显示出来,这就需要外层使用ScrollView,ScrollView里面放置一个重绘高度的ListView ...

  2. WinForm中重绘TabControl选项卡标题

    最近开发WinForm频繁使用了TabControl控件,这个控件的选项卡没有BackgroundImage这个属性,那么如何为其各个选项卡添加背景图片呢?(这里说的是每个TabPage的头部,也就是 ...

  3. Reflow(回流)和Repaint(重绘) (转)

    原文地址:http://blog.csdn.net/qq_18826911/article/details/68924255 首先我们要明白的是,页面的显示过程分为以下几个阶段: 1.生成DOM树(包 ...

  4. 高性能WEB开发:重排与重绘

    DOM编程可能最耗时的地方,重排和重绘. 1.什么是重排和重绘 浏览器下载完页面中的所有组件——HTML标记.JavaScript.CSS.图片之后会解析生成两个内部数据结构——DOM树和渲染树. D ...

  5. 重绘TabControl

    本文转载自:http://blog.csdn.net/conmajia/article/details/7596718 作者:野比 (conmajia@gmail.com) 时间:May, 2012 ...

  6. 重绘DevExpress的XtraMessageBox消息提示框控件

    先来看提示框,可以看到框其实是一个去掉最大化.最小化按钮后的窗体,窗体的内容就是我们想要提示的内容,重绘提示框其实就是重绘窗体以及中间部分的内容. 首先重绘窗体,消息提示框的窗体不是XtraForm而 ...

  7. 关于repaint(重绘)和reflow( 回流)

    repaint就是重绘,reflow就是回流.repaint主要是针对某一个DOM元素进行的重绘,reflow则是回流,针对整个页面的重排 严重性: 在性能优先的前提下,性能消耗 reflow大于re ...

  8. iOS 视图:重绘与UIScrollView(内容根据iOS编程编写)

    我们继续之前的 Hypnosister 应用,当用户开始触摸的时候,圆形的颜色会改变. 首先,在 JXHypnosisView 头文件中声明一个属性,用来表示圆形的颜色. #import " ...

  9. Reflow(渲染)和Repaint(重绘)

    Reflow(渲染):对于DOM结构中的各个元素都有自己的盒模型,浏览器根据各种样式(浏览器的.开发人员定义的等)来计算,并根据计算结果将元素放到它该出现的位置,这个过程称之为reflow. refl ...

随机推荐

  1. IE10、IE11和Microsoft Edge的Hack

    IE10.IE11和Microsoft Edge的Hack 随着Win10的推广,Microsoft Edge浏览器已经越来越普遍,但是IE11也是伴随其中,尾大不掉. 首先,了解一下概念,如下图:微 ...

  2. hive外部表的建立与数据匹配

    1.建立hive的外部表匹配hdfs上的数据 出现如下报错: hive (solar)> ; OK Failed with exception java.io.IOException:java. ...

  3. JSON的一些细节

    这篇JSON的随笔只是为了简单地复习一下学习到的JSON的内容.都是一些很基础的东西.如果你不小心看到了这篇文,那就一起复习吧.(。・∀・)ノ JSON不支持JavaScript中的undefined ...

  4. zoom和transform:scale的区别

    小tips: zoom和transform:scale的区别 这篇文章发布于 2015年11月3日,星期二,00:52,归类于 css相关. 阅读 7876 次, 今日 8 次 by zhangxin ...

  5. java selenium (十二) 操作弹出窗口

    selenium 中如何处理弹出窗口 阅读目录 原理 在代码里, 通过         Set<String> allWindowsId = driver.getWindowHandles ...

  6. float和double的精度

    作者: jillzhang 联系方式:jillzhang@126.com 原网址:http://blog.csdn.net/wuna66320/article/details/1691734 1 范围 ...

  7. CodeForces #368 div2 D Persistent Bookcase DFS

    题目链接:D Persistent Bookcase 题意:有一个n*m的书架,开始是空的,现在有k种操作: 1 x y 这个位置如果没书,放书. 2 x y 这个位置如果有书,拿走. 3 x 反转这 ...

  8. js判断qq浏览器

    if(navigator.userAgent.toLowerCase().toString().indexOf('qqbrowser') > -1){ console.log('qq');}el ...

  9. java 从数据删除指定值

    public class ArrayRemoveValue { public static void main(String[] args) { Integer[] _IntArray = new I ...

  10. C语言简易文法(无左递归)

    <程序> -〉 <外部声明> | <函数定义><外部声明> -〉<头文件> | <变量> | <结构体> <头 ...