winform:


gridView1"EndSorting"事件中加入以下代碼:
 1private void gridView1_EndSorting(object sender, EventArgs e)
 2        {
 3            Color clr = gridView1.Appearance.Row.BackColor;
 4            foreach (DevExpress.XtraGrid.Columns.GridColumn dc in gridView1.Columns)
 5            {
 6                if (dc.VisibleIndex == gridView1.SortedColumns[0].VisibleIndex)
 7                {
 8                    dc.AppearanceCell.BackColor = Color.Red;
 9                }

10                else
11                {
12                    dc.AppearanceCell.BackColor = clr;
13                }

14            }

15        }


webfrom:

DataGridSortCommand事件加入以下代碼:

 1foreach(DataGridColumn dgc in dg.Columns)
 2{
 3 if (dgc.SortExpression == e.SortExpression)
 4 {
 5  dgc.ItemStyle.BackColor = Color.Red;
 6 }

 7 else
 8 {
 9  dgc.ItemStyle.BackColor = Color.White;
10 }

11}

 

其中dgDataGrid的實例,eSortCommand事件傳入的DataGridSortCommandEventArgs類型參數

posted on 2006-09-22 11:47  fosoyo  阅读(5028)  评论(3编辑  收藏  举报