求教各位大侠,小弟用datagridview的checkbox列,想实现将选中行排序到表的前排,然后打印选中行。
该checkbox列的stormode属性设置Automatic,datagridview的数据源为一个ACCESS数据库。现象为选中表中部分项然后点击checkbox列头进行排序,但打印是则为排序前相应位置的行内容。
筛选代码如下:
for (int i = 0; i < count; i++)
{
dataGridView1.EndEdit();
DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)dataGridView1.Rows[i].Cells[0];
Boolean flag = Convert.ToBoolean(checkCell.Value);
if (flag == true)
{
for (int j = 1; j <= 5; j++)
{ e.Graphics.DrawString((string)dt.Rows[i].ItemArray[j].ToString(), ff, Brushes.Black, x, y);
if (j == 1)
{
x += 80;
}
x += 32;
}
x = 10;
y += gao;
}
}
求各位大侠帮忙分析原因和解决方法
该checkbox列的stormode属性设置Automatic,datagridview的数据源为一个ACCESS数据库。现象为选中表中部分项然后点击checkbox列头进行排序,但打印是则为排序前相应位置的行内容。
筛选代码如下:
for (int i = 0; i < count; i++)
{
dataGridView1.EndEdit();
DataGridViewCheckBoxCell checkCell = (DataGridViewCheckBoxCell)dataGridView1.Rows[i].Cells[0];
Boolean flag = Convert.ToBoolean(checkCell.Value);
if (flag == true)
{
for (int j = 1; j <= 5; j++)
{ e.Graphics.DrawString((string)dt.Rows[i].ItemArray[j].ToString(), ff, Brushes.Black, x, y);
if (j == 1)
{
x += 80;
}
x += 32;
}
x = 10;
y += gao;
}
}
求各位大侠帮忙分析原因和解决方法
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货