转的: 重绘ListView 修改标题颜色
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 修改标题颜色的更多相关文章
- Android重绘ListView高度
Android重绘ListView高度 经常会有这样需求,需要ListView默认将所有的条目显示出来,这就需要外层使用ScrollView,ScrollView里面放置一个重绘高度的ListView ...
- WinForm中重绘TabControl选项卡标题
最近开发WinForm频繁使用了TabControl控件,这个控件的选项卡没有BackgroundImage这个属性,那么如何为其各个选项卡添加背景图片呢?(这里说的是每个TabPage的头部,也就是 ...
- Reflow(回流)和Repaint(重绘) (转)
原文地址:http://blog.csdn.net/qq_18826911/article/details/68924255 首先我们要明白的是,页面的显示过程分为以下几个阶段: 1.生成DOM树(包 ...
- 高性能WEB开发:重排与重绘
DOM编程可能最耗时的地方,重排和重绘. 1.什么是重排和重绘 浏览器下载完页面中的所有组件——HTML标记.JavaScript.CSS.图片之后会解析生成两个内部数据结构——DOM树和渲染树. D ...
- 重绘TabControl
本文转载自:http://blog.csdn.net/conmajia/article/details/7596718 作者:野比 (conmajia@gmail.com) 时间:May, 2012 ...
- 重绘DevExpress的XtraMessageBox消息提示框控件
先来看提示框,可以看到框其实是一个去掉最大化.最小化按钮后的窗体,窗体的内容就是我们想要提示的内容,重绘提示框其实就是重绘窗体以及中间部分的内容. 首先重绘窗体,消息提示框的窗体不是XtraForm而 ...
- 关于repaint(重绘)和reflow( 回流)
repaint就是重绘,reflow就是回流.repaint主要是针对某一个DOM元素进行的重绘,reflow则是回流,针对整个页面的重排 严重性: 在性能优先的前提下,性能消耗 reflow大于re ...
- iOS 视图:重绘与UIScrollView(内容根据iOS编程编写)
我们继续之前的 Hypnosister 应用,当用户开始触摸的时候,圆形的颜色会改变. 首先,在 JXHypnosisView 头文件中声明一个属性,用来表示圆形的颜色. #import " ...
- Reflow(渲染)和Repaint(重绘)
Reflow(渲染):对于DOM结构中的各个元素都有自己的盒模型,浏览器根据各种样式(浏览器的.开发人员定义的等)来计算,并根据计算结果将元素放到它该出现的位置,这个过程称之为reflow. refl ...
随机推荐
- WC项目
#include <stdio.h> #include <string.h> int *getCharNum(char *filename, int *totalNum); i ...
- 实际项目中的一个angularjs 应用
实际需求:通过下拉框,选择自己需要的类型,创建元素(要求必须是输入点击保存了才能出现对应的类型块) html代码: <div class="list-panel-data"& ...
- github使用
1.首先登录到https://github.com注册Github帐号,并且创建一个repository. 例如:注册的github帐号名为whu-zhangmin,创建的repository名称为w ...
- 书旗小说app点评
书旗小说这个手机软件用了好久了,大一的时候就开始用,业余无聊时间可以看一看网络小说打发一下时间. 书旗免费小说是一款内容以免费小说书旗网为基础的在线阅读器,除了拥有传统阅读器的书籍同步阅读.全自动书签 ...
- PHP制作验证码
session_start();$a = array('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r',' ...
- python cmd下运行中文乱码 策略
如我运行一个脚本,执行后输出中文看不懂 然后呢在文件头加上 from __future__ import unicode_literals 注意:需要去掉所有字符串前的 u, 这样所有字符串均默认为u ...
- python学习04——列表的操作
笨办法学python第38节 如何创建列表在第32节,形式如下: 本节主要是讲对列表的操作,首先讲了 mystuff.append('hello') 的工作原理,我的理解是,首先Python找到mys ...
- C学习
\a:警报 1.exit(),提前结束程序.include <stdlib.h> 2.getch()无缓存.getchar()有缓存,多条连用时注意末尾换行符否则始终.putchar(). ...
- 嵌入式Linux的调试技术
本节我们研究嵌入式Linux的调试技术,对于复杂的Linux驱动及HAL等程序库,需要使用各种方法对其进行调试.刚开始讲了打印内核调试信息:printk,这个函数的用法与printf函数类似,只不过p ...
- 在一台机器上模拟mongodb分片
首先选择一个目录在其中建立以下2个文件夹:data和log 在data下建立9个文件夹: 其中前3个为配置服务器所在文件夹,按照官网要求,一个集群需要3个config server rs-a-n和rs ...