• DEV GridControl 小结(持续添加)


    一、属性:

    1、Views

    OptionsBehavior=>Editable:False  列表不可编辑

    OptionsSelection=>EnableAppearanceFocusedCell :False   选中整行

    在设置了奇偶行样式后需要起用设置,不然无效

    OptinsView=>EnableAppearanceEvenRow :True   起用偶数行样式

    OptinsView=>EnableAppearanceOddRow :True    起用奇数行样式

    OptinsView=>ShowGroupPanel:False   隐藏分组面板

    2、Columns

    SortOrder 设置按该列排序方法 (Descending:降序 ;Ascending:升序)

    UnboundType  设置为非绑定列,并设置数据类型

    ColumnsEdit 可以在该列中添加控件,在 In-place Editor中添加控件,ButoonEdit为按钮

    点中按钮获取焦点行

    1 if (this.gvMain_Blood.FocusedRowHandle < 0)
    2                 return;

    如果设置了主从表结构,那么在从表中为

    1  DevExpress.XtraGrid.Views.Grid.GridView gv = (DevExpress.XtraGrid.Views.Grid.GridView)gcMain.FocusedView;
    2             int a = gv.FocusedRowHandle;
    3             if (a < 0)
    4                 return;

    3、Appearance

    FocusedRow 被选中行样式设置

    EvenRow  偶数行样式设置

    OddRow   奇数行样式设置

    GroupRow 分组行样式设置

    4、其它属性设置

    ExpandMasterRow 展开所有子表

    1          if (gv.RowCount > 0)
    2             {
    3                 for (int i = 0; i < gv.RowCount; i++)
    4                 {
    5                     this.gv.ExpandMasterRow(i);
    6                 }
    7             }

     二、事件

    CustomDrawRowIndicator 自动添加行号

    1  if (e.Info.IsRowIndicator &&e.RowHandle>=0)
    2        {
    3         e.Info.DisplayText = (e.RowHandle + 1).ToString();
    4        }

    CustomUnboundColumnData  非绑定列数据绑定

    1 if (e.RowHandle < 0)
    2                 return;
    3 if (e.Column.FieldName == "非绑定列列名") 
    4      {
    5       e.vaule="";
    6      }

    RowClick 行选中事件

    CustomColumnDisplayText 自定义列

    1 //绑定列值为空时显示固定字符串
    2 if (e.Column.FieldName == "列名")
    3             {
    4                 if (e.Value == null)
    5                 {
    6                     e.DisplayText = "字符串";
    7                 }
    8             }

    Blood_MasterRowGetChildList 绑定从表数据

    if (e.RowHandle < 0)
                    return;
    List<T> dateList=new List<T>
     e.ChildList = dateList
    

      

    MasterRowGetRelationCount 设置从表个数

    e.RelationCount = 1;
    

      

    MasterRowGetRelationName 主从表关系设置

    1  e.RelationName = "Detail"; //从表LevelName 一定要设置为Detail才能关联主从表

    CustomDrawEmptyForeground  查询得到0条数据时显示自定义字符

    1 if (this.gv.RowCount==0)
    2             {
    3                 string str = "没有查询到信息!";
    4                 Font f = new Font("宋体", 9, FontStyle.Bold);
    5                 Rectangle r = new Rectangle(e.Bounds.Left + 5, e.Bounds.Top + 5, e.Bounds.Width - 5, e.Bounds.Height - 5);
    6                 e.Graphics.DrawString(str, f, Brushes.Black, r);
    7             }
  • 相关阅读:
    Codeforces Round #183 (Div. 2) B. Calendar
    FZU Problem 2030 括号问题
    NEU(1262: ASCII Sequence II)动态规划
    ZOJ(1711)Sum It Up (DFS+剪枝+去重复)
    ZOJ(1004)Anagrams by Stack (DFS+stack)
    HDU(3374) (KMP + 最小表示法)
    FZU Problem 1926 填空(KMP好题一枚,确实好)
    POJ(2481)Cows 树状数组
    HOJ (1042) 整数划分
    LeetCode: Two Sum
  • 原文地址:https://www.cnblogs.com/mengyirensheng/p/3262144.html
Copyright © 2020-2023  润新知