C# DataGridView 在最左侧显示行号方法
代码:
private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
{
DataGridView dgv = sender as DataGridView;
Rectangle rectangle = new Rectangle(e.RowBounds.Location.X,
e.RowBounds.Location.Y,
dgv.RowHeadersWidth - ,
e.RowBounds.Height); TextRenderer.DrawText(e.Graphics, (e.RowIndex + ).ToString(),
dgv.RowHeadersDefaultCellStyle.Font,
rectangle,
dgv.RowHeadersDefaultCellStyle.ForeColor,
TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
}
效果:
C# DataGridView 在最左侧显示行号方法的更多相关文章
- sql server2005查询分析器显示行号方法
工具栏:工具--选项--文本编辑器---所有语言--右边复选框 行号 打上勾就ok了
- IntelliJ IDEA 显示行号方法
设置方法如下: File->Settings->Editor->General->Appearence->Show Line Number
- IntelliJ IDEA显示行号方法
File->Settings->Editor->General->Appearence->Show line numbers
- DataGridView显示行号-RowPostPaint
DataGridView控件在显示数据时,我们有时候需要显示行号,以便检索查看方便使用. 但DataGridView默认没有设置显示行号的属性. 此时我们只要在DataGridView的RowPost ...
- Python+PyCharm的一些基本设置:安装使用、注册码、显示行号、字体大小和快捷键等常用设置
一 下载与安装 软件下载,软件文档下载:http://www.jetbrains.com/pycharm/download/ 如下图: 官方网站下载:http://www.oschina.net/p/ ...
- python3.4学习笔记(十八) pycharm 安装使用、注册码、显示行号和字体大小等常用设置
python3.4学习笔记(十八) pycharm 安装使用.注册码.显示行号和字体大小等常用设置Download JetBrains Python IDE :: PyCharmhttp://www. ...
- DataGridView大扩展——显示行号
原文 DataGridView大扩展——显示行号 在DataGridView 的实际使用中,经常需要标示出行号,这样可以比较醒目地看到当前信息.不过DataGridView 在绘制 DataGridV ...
- Winform中的DatagridView显示行号
1.设置 RowPostPaint 为true 2.启用RowPostPaint事件 /// <summary> /// DataGridView显示行号 /// </summary ...
- DataGridView显示行号
//可以在DataGirdView的RowPostPaint事件中进行绘制. //如:添加以下方法代码 private void DrawRowIndex(object sender, DataGri ...
随机推荐
- Apache ab 压力并发测试工具
当你使用PHP(或其他编程语言)完成一个web程序的开发,并且web程序在Apache服务器上正常运行的时候,你有没有考虑过对你的Apache服务器及部署在其上的web程序进行一些压力测试呢?毕竟,真 ...
- T-codes & Rarely Seen Tables(Updated from previous note)
T-codes C CO CO01/02/03:Production Order CG CG3Y:Download file from server,never used this before CM ...
- [leetcode]40. Combination Sum II组合之和之二
Given a collection of candidate numbers (candidates) and a target number (target), find all unique c ...
- [leetcode]46. Permutations全排列(给定序列无重复元素)
Given a collection of distinct integers, return all possible permutations. Input: [1,2,3] Output: [ ...
- 回溯算法_ BackTracking
目前还存在的疑问: 1. 所谓的该分支满足条件之后就回退到上一层节点,可是加谁呢? x[i+1] ?? 加到 N, 不满足target sum条件就返回上一级(同时改变上一级数为 i+1...纵向 ...
- MySQL优化(五) SQL 语句的优化 索引、explain
一.索引 1.分类 (1)主键索引:当一张表的某个字段设置为主键时,该字段就是主键索引: (2)唯一索引:索引列中的值必须是唯一的,但是允许为空值(可以存在多个null): (3)普通索引:基本索引类 ...
- Mouse Detected Problem
通常分三种情形: 鼠标完全不工作鼠标工作一段时间后不工作鼠标的按钮或者滚轮不工作 必要提交信息:1.鼠标的具体厂商和型号2.鼠标连接PC方式:串口.PS/2.USB或无线USB等:3.鼠标的工作机制: ...
- HTML第一篇
Hyper Text Markup Language 超文本标记语言:是一种创建网页的标准标记语言. <!DOCTYPE html> <html> <head> ...
- 用ps增加照片的气氛--镜头光晕
1.寻找一张图片 2.新建一个图层填充为黑色 3.选择滤镜---渲染---镜头光晕 4.选择图层模式---滤色. 编辑:千锋UI设计
- Rsync常见错误和问题
五.常见问题 以下是为配置rsync时的常见问题: 问题一:@ERROR: chroot failedrsync error: error starting client-server protoco ...