if(retrievalList[i][j].ToString().Equals( retrievalList[i-1][j].ToString()))
{
DataGridCell dc = new DataGridCell();
dc.RowNumber=i;
dc.ColumnNumber=j;
dgRetrivalList.CurrentCell = dc;
dgRetrivalList[dc] = DBNull.Value;
}
else
{
DataGridCell dc = new DataGridCell();
dc.RowNumber=i;
dc.ColumnNumber=j;
dgRetrivalList.CurrentCell = dc;
dgRetrivalList[dc] = retrievalList[i][j];
}
外面我用两个For loop来跑行和列,但是好像没有作用,还是显示所有的记录,各位有什么好办法吗?
谢谢。
{
DataGridCell dc = new DataGridCell();
dc.RowNumber=i;
dc.ColumnNumber=j;
dgRetrivalList.CurrentCell = dc;
dgRetrivalList[dc] = DBNull.Value;
}
else
{
DataGridCell dc = new DataGridCell();
dc.RowNumber=i;
dc.ColumnNumber=j;
dgRetrivalList.CurrentCell = dc;
dgRetrivalList[dc] = retrievalList[i][j];
}
外面我用两个For loop来跑行和列,但是好像没有作用,还是显示所有的记录,各位有什么好办法吗?
谢谢。
(e.Item.ItemType == ListItemType.AlternatingItem))
{
// e.Item.Cells[2].Text
}
我写的windows程序,找不到ItemDataBound事件啊。To:JasonHeung
不好意思,我还没有用过ListView,因为我的输出是一个比较复杂的表格,包括checkbox和cobobox,用listbox也可以达到同样的效果吗?谢谢
dataGrid1——Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
CurrencyManager cr = (CurrencyManager) this.BindingContext[dataGrid1.DataSource,dataGrid1.DataMember];
if(cr.Count==0)
return;
int row=0;
DataView dv=(DataView)dataGrid1.DataSource;
while(row < cr.Count)
{
int v=int.Parse(dv[row]["age"].ToString());
if(v>40)//判断年龄大于40就改变颜色
{
e.Graphics.FillRectangle(new System.Drawing.SolidBrush(Color.Snow),ataGrid1.GetCellBounds(new DataGridCell(row, col)));
e.Graphics.DrawString("年龄大于四十", dataGrid1.Font, new System.Drawing.SolidBrush(Color.Red),dataGrid1.GetCellBounds(new DataGridCell(row, col)));
}
row++;
}
}