设为首页 加入收藏

TOP

Devexpress之GridControl显示序列号
2019-09-03 01:13:48 】 浏览:24
Tags:Devexpress GridControl 显示 序列号

先上图:

操作方法:

1、先设置一下gridview中属性:IndicatorWidth,一般为:40。如下图;(一般可以显示5位数字。如要更长显示,自己测试一下。)

2、找到gridview中的:CustomDrawRowIndicator事件,输入如下面代码:

 1  private void gvMachine_CustomDrawRowIndicator(object sender, DevExpress.XtraGrid.Views.Grid.RowIndicatorCustomDrawEventArgs e)
 2         {
 3             e.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Far;
 4             if (e.Info.IsRowIndicator)
 5             {
 6                 if (e.RowHandle >= 0)
 7                 {
 8                     e.Info.DisplayText = (e.RowHandle + 1).ToString();
 9                 }
10                 else if (e.RowHandle < 0 && e.RowHandle > -1000)
11                 {
12                     e.Info.Appearance.BackColor = System.Drawing.Color.AntiqueWhite;
13                     e.Info.DisplayText = "G" + e.RowHandle.ToString();
14                 }
15             }
16         }
View Code

 

】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇总结相对路径和绝对路径的写法 下一篇.NET中的repeater简介及分页效果

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目