DataGridview 绘制行序号

RowPostpaint 事件

 

通过Rectangle(矩形的意思)对象绘制矩形区域,然后在通过textRendererDeawText方法来绘制序列号。

Rectanglex,y width,height

DrawText( IDeviceContext dc,text,font,Rectangle boundsforeColor,TextFormatFlages);

 

Rectanglex,y,width,height

Drawtext(IDeviceContext dc,text,font,Rectanglebounds,forecolor,textformatflags);

原文地址:https://www.cnblogs.com/xiaowie/p/8651677.html