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 ...
随机推荐
- 伪类+js实现CSS3 media queries跨界准确判断
@media screen and (min-width: 45em) { body:after{ content:"宽屏" } } var content = window.ge ...
- LR基础理论详解
本人参考了大神的博客(https://blog.csdn.net/cyh_24/article/details/50359055),写的非常详细,在此整理一下要点 逻辑斯蒂分布 基础公式了解 二项逻辑 ...
- [leetcode]49. Group Anagrams变位词归类
Given an array of strings, group anagrams together. Example: Input: ["eat", "tea" ...
- 将VSCode设置成中文语言环境
VSCode是一款轻量级的好用的编译软件,今天小编来将软件默认的英文语言环境变为我们熟悉的中文语言环境. 工具/原料 电脑一台 安装有VSCode 方法/步骤 首先打开VSCode软件,可 ...
- shell启动执行cypher语句
1.跳转到目录:cd /data/soft/neo4j-community-not/ 2.修改配置文件:nano ./conf/neo4j.conf: 3. 登录:bin/cypher-shell - ...
- xsd
2018-10-08 <xsd:annotation> <xsd:documentation> <![CDATA[ 说明文档 ]]> </xsd:docume ...
- 使用fabric2打包部署文件
一直以来都是复制粘贴或者拖动文件完成部署,实在是低效得很!学了学fabric,写个了脚本.如下: from fabric import Connection import shutil HOST = ...
- 201771010142 张燕 Java的基本程序设计结构第二周学习总结
第三章 Java的基本程序设计结构 第一部分 理论知识学习部分 一 基本知识: 1.标识符:由字母.下划线,美元符号和数字组成,第一个符号不能为数字,可以用作类名.变量名.方法名.数组名和文件名等. ...
- spring web参数传递
spring boot 参数相关 ****************************************** @RequestParam 这个注解用来绑定单个请求数据,既可以是url中的 ...
- ABP框架系列之四十五:(Quartz-Integration-Quartz-集成)
Introduction Quartz is a is a full-featured, open source job scheduling system that can be used from ...