GridView列相同合并

private void gridView1_CellMerge(object sender, DevExpress.XtraGrid.Views.Grid.CellMergeEventArgs e)
{
if (e.Column.FieldName == "SPARE_ITEM_6")
{
string a1 = this.gridView1.GetRowCellValue(e.RowHandle1, "SPARE_ITEM_6").ToString();
string a2 = this.gridView1.GetRowCellValue(e.RowHandle2, "SPARE_ITEM_6").ToString();

string a3 = this.gridView1.GetRowCellValue(e.RowHandle1, "SPARE_ITEM_2").ToString();
string a4 = this.gridView1.GetRowCellValue(e.RowHandle2, "SPARE_ITEM_2").ToString();

e.Merge = a1 == a2 ;

}
else if (e.Column.FieldName == "ROLL_PLAN_NO")
{
string a3 = this.gridView1.GetRowCellValue(e.RowHandle1, "ROLL_PLAN_NO").ToString();
string a4 = this.gridView1.GetRowCellValue(e.RowHandle2, "ROLL_PLAN_NO").ToString();

e.Merge = a3 == a4;

e.Handled = true;

}
else
{
e.Merge =false;

} e.Handled = true;
}

posted @ 2024-07-19 16:39  Wangbin0007  阅读(44)  评论(0)    收藏  举报