zoukankan      html  css  js  c++  java
  • GridControl 選中某列進行排序時,怎麼能讓那列高亮顯示

    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類型參數

  • 相关阅读:
    iOS UILable 自定义高度 用masony适配
    iOS上架所需图片大小明细
    GCD倒计时
    iOS 小知识汇总
    七、Swift 枚举 Enumerations
    C语言深度剖析笔记
    六、闭包 Closures
    经济学常识
    Mac小技巧
    五、函数 Functions
  • 原文地址:https://www.cnblogs.com/King0502/p/2019300.html
Copyright © 2011-2022 走看看