DataGridView显示行号
//可以在DataGirdView的RowPostPaint事件中进行绘制。
//如:添加以下方法代码 private void DrawRowIndex(object sender, DataGridViewRowPostPaintEventArgs e)
{
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
e.RowBounds.Location.Y,
this.costomerDataGridView.RowHeadersWidth - ,
e.RowBounds.Height); TextRenderer.DrawText(e.Graphics, (e.RowIndex + ).ToString(),
this.costomerDataGridView.RowHeadersDefaultCellStyle.Font,
rectangle,
this.costomerDataGridView.RowHeadersDefaultCellStyle.ForeColor,
TextFormatFlags.VerticalCenter | TextFormatFlags.Right); }
//即可完成显示行号的功能。
DataGridView显示行号的更多相关文章
- Winform中的DatagridView显示行号
1.设置 RowPostPaint 为true 2.启用RowPostPaint事件 /// <summary> /// DataGridView显示行号 /// </summary ...
- DataGridView显示行号-RowPostPaint
DataGridView控件在显示数据时,我们有时候需要显示行号,以便检索查看方便使用. 但DataGridView默认没有设置显示行号的属性. 此时我们只要在DataGridView的RowPost ...
- C# DataGridView显示行号的三种方法
方法一: 网上最常见的做法是用DataGridView的RowPostPaint事件在RowHeaderCell中绘制行号: private void dgGrid_RowPostPaint( obj ...
- DataGridView显示行号的几种方法来自http://www.soaspx.com/dotnet/csharp/csharp_20100204_2740.html
方法一: 网上最常见的做法是用DataGridView的RowPostPaint事件在RowHeaderCell中绘制行号: private void dataGridView1_RowPostPai ...
- 【转】DataGridView显示行号
ref:http://blog.csdn.net/xieyufei/article/details/9769631 方法一: 网上最常见的做法是用DataGridView的RowPostPaint事件 ...
- 让DataGridView显示行号
http://www.cnblogs.com/JuneZhang/archive/2011/11/21/2257630.html 为了表示行号,我们可以在DataGridView的RowP ...
- DataGridView 显示行号与背景颜色
实现的方式有好几种.之前使用的是下面这种在RowPostPaint事件中实现,效率不高.每次改变控件尺寸时都会执行 private void MsgGridView_RowPostPaint(obje ...
- DataGridView大扩展——显示行号
原文 DataGridView大扩展——显示行号 在DataGridView 的实际使用中,经常需要标示出行号,这样可以比较醒目地看到当前信息.不过DataGridView 在绘制 DataGridV ...
- DataGridView自动行号
最近又用了一下DataGridView控件,需要显示行号,我们知道在.net中DataGridView控件默认是不显示行号(数据的记录行数)的,后来通过查资料发现可以在DataGridView控件的R ...
随机推荐
- 如何在WP8模拟器中连接本地的web服务
这个问题困扰了很久,查找答案一度找偏方向. 其实连接web服务对于wp7不是问题,因为wp7使用的网络就是本机的网络,但是到了wp8模拟器,纯粹的虚拟机,独立的设备,也就有了自己的网络连接,要当做虚拟 ...
- IBM SPSS Modeler 预测建模基础(一)
1.搜索下载IBM SPSS Modeler 14.1 32位 及 IBM SPSS Modeler 14.1 注册文件(破解布丁): 2.下载train.csv 及 test.csv: train. ...
- [转载]一个小例子介绍Obj-C的函数命名方式
原文链接:http://www.cnblogs.com/liufan9/archive/2013/04/02/2995626.html 对于以前做C#或者JAVA开发的朋友而言,初次接触iOS开发,O ...
- struts 学习之问一
今天在进行struts全局类型和局部类型转换时,发现一个问题,如下: 当输入一个点的坐标时,我使用全局转换提示错误,找不到类,当改变成局部类型转换时,可以成功转换,不知道这个是什么原因,难道全局不可以 ...
- SQL Server 数据类型 Decimal介绍
为SQL Server 数据类型,属于浮点数类型.存储数据范围是: -1038~1038-1 的固定精度和小数位的数字.一个decimal类型的数据占用了2~17个字节.decimal数据类型在SQL ...
- Win8.1系统下安装nodeJS
Nodejs简介 Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境.Node.js 使用了一个事件驱动.非阻塞式 I/O 的模型,使其轻量又高效.Node.js ...
- SqlServer日期查询
一.sql server日期时间函数 Sql Server中的日期与时间函数 1. 当前系统日期.时间 select getdate() 2. dateadd 在向指定日期加上一段时间的基础上,返 ...
- cherry-pick,revert和rebase使用的3-way合并策略
git中的cherry-pick,revert和rebase都使用的是3-way合并策略,下面就来看看这3个方法使用的merge-base,ours和theirs分别是什么. cherry-pick ...
- redis学习研究--Redis作者谈Redis应用场景
毫无疑问,Redis开创了一种新的数据存储思路,使用Redis,我们不用在面对功能单调的数据库时,把精力放在如何把大象放进冰箱这样的问题上,而是利用Redis灵活多变的数据结构和数据操作,为不同的大象 ...
- [Head First Python]4. pickle.dump pickle.load
sketch.py #--*-- coding:utf-8 --*-- import pickle import nester man = [] other = [] try: data = open ...