惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

腾讯CDC
Schneier on Security
Schneier on Security
B
Blog RSS Feed
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
A
About on SuperTechFans
Recorded Future
Recorded Future
Recent Announcements
Recent Announcements
Microsoft Security Blog
Microsoft Security Blog
L
LangChain Blog
Hugging Face - Blog
Hugging Face - Blog
The GitHub Blog
The GitHub Blog
Google DeepMind News
Google DeepMind News
T
Tailwind CSS Blog
Vercel News
Vercel News
H
Hackread – Cybersecurity News, Data Breaches, AI and More
MyScale Blog
MyScale Blog
V2EX - 技术
V2EX - 技术
N
Netflix TechBlog - Medium
F
Fortinet All Blogs
V
Visual Studio Blog
Martin Fowler
Martin Fowler
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
T
The Exploit Database - CXSecurity.com
F
Full Disclosure
Scott Helme
Scott Helme
H
Heimdal Security Blog
博客园 - 叶小钗
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
Application and Cybersecurity Blog
Application and Cybersecurity Blog
V
Vulnerabilities – Threatpost
Blog — PlanetScale
Blog — PlanetScale
Security Latest
Security Latest
WordPress大学
WordPress大学
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Troy Hunt's Blog
S
SegmentFault 最新的问题
Forbes - Security
Forbes - Security
Jina AI
Jina AI
S
Securelist
小众软件
小众软件
Simon Willison's Weblog
Simon Willison's Weblog
J
Java Code Geeks
AWS News Blog
AWS News Blog
N
News and Events Feed by Topic
博客园 - 三生石上(FineUI控件)
量子位

博客园 - 缤纷夏日

文件分割合并DOS版 安装vs2017后,RDLC 报表定义具有无法升级的无效目标命名空间 frp+TeamViewer 完美解决TeamViewer5分钟商业提醒 TortoiseGit版本库中某个文件显示问号或叹号的问题解决办法 vs2012调试时,抛出异常的等待时间很慢,原来是QQ电脑管家搞的鬼。 wordpress4.4+版本自动生成一个768w像素缩略图的解决办法 vs2012 与 win7 不兼容的问题 c#+Winform实现自定义的“复制、粘贴”右键快捷菜单,多个控件共享使用一个右键菜单。 自制《要塞:十字军东征》无限金钱修改器 ms Sql 数据库出现 “提供的统计信息流已损坏”的解决办法。 C#+Midi 模拟各种乐器演奏 如何让DataGridView根据数据“0”或“1”等值显示为“是”或“否”(复选框的使用) DataGridView 显示和隐藏DataGridViewButtonCell按钮的办法 文件隐藏助手,将一个压缩文件隐藏到图片中 如何让DataGridview控件自动滚动到指定的行或列 在Excel Vba程序中自制进度条,显示实时进度信息 Winform中的DataGridView控件内容自动保存 地下城守护者2 无限魔法修改器 缤纷影视系统3.0源码开放
为Winform程序中DataGridView控件增加自动显示行号功能
缤纷夏日 · 2010-10-16 · via 博客园 - 缤纷夏日

网上找了几种显示行号的方法,采用了其中一种,在行头显示行号,很实用,如图:

代码如下:

private void gvTransferList_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e)
        {
            Rectangle rectangle = new Rectangle(e.RowBounds.Location.X, e.RowBounds.Location.Y, gvTransferList.RowHeadersWidth, e.RowBounds.Height);
            TextRenderer.DrawText(e.Graphics, (e.RowIndex + 1).ToString(),
                gvTransferList.RowHeadersDefaultCellStyle.Font, rectangle, gvTransferList.RowHeadersDefaultCellStyle.ForeColor,
                TextFormatFlags.VerticalCenter | TextFormatFlags.Right);
        }