Home > Net >  Datagridview hidden line without increasing number
Datagridview hidden line without increasing number

Time:11-21

There are a lot of hidden in the datagridview, automatically increase the serial number is not including the hidden rows only ordering the number of rows in the displayed information
Help!!!!!!

CodePudding user response:

How to row number, do you add or data itself, some

CodePudding user response:

Own add
Private void GV_RowPostPaint (object sender, DataGridViewRowPostPaintEventArgs e)
{
A Rectangle Rectangle=new Rectangle (" e.R owBounds. Location. X,
"E.R owBounds. Location. Y,
GV. RowHeadersWidth - 4,
"E.R owBounds. Height);
TextRenderer. DrawText (um participant raphics, (" e.R owIndex + 1). The ToString (),
GV. RowHeadersDefaultCellStyle. The Font,
A rectangle,
GV. RowHeadersDefaultCellStyle. ForeColor,
TextFormatFlags. VerticalCenter | TextFormatFlags. Right);
}

CodePudding user response:



 void refresh () 
{
Int count=1;
Foreach (DataGridViewRow row in this. DataGridView1. Rows)
{
If (row. Visible)
{
Row. HeaderCell. Value=(https://bbs.csdn.net/topics/count++.ToString);
}
}
}
  •  Tags:  
  • C#
  • Related