首页 > 代码库 > DevExpress控件笔记

DevExpress控件笔记

DateEdit设置手录格式(yyyy-MM-dd) (yyyy-MM-dd HH:mm)

/*
 * 设置DateEdit手动录入格式(yyyy-MM-dd yyyy-MM-dd hh:mm)
 * DateRegEx = @"((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))";
 * DateTimeRegEx = @"((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-)) (20|21|22|23|[0-1]?\d):[0-5]?\d";
 * MaskType DevExpress.XtraEditors.Mask.MaskType.RegEx
 */
DateEdit.Properties.Mask.EditMask = PublicConstant.DateRegEx;
DateEdit.Properties.Mask.MaskType = DevExpress.XtraEditors.Mask.MaskType.RegEx;

Enter键跳格

/*
 * 文本框Enter跳转下一控件
 */
TextEdit.EnterMoveNextControl = true;

LookUpEdit添加操作按钮

/*LookUpEdit添加操作按钮
 * 添加Properties_ButtonClick事件
 * 判断按钮类型(枚举) 针对不同类型实现相应功能 */

  if (e.Button.Kind== ButtonPredefines.Delete)  
        lookUpCompanyName.EditValue = null;  

GridView绘制行号

/*网格绘制行号
 * CustomDrawRowIndicator事件 */
    if (e.Info.IsRowIndicator)
    {
        if (e.RowHandle >= 0)
        {
            e.Info.DisplayText = (e.RowHandle + 1).ToString();
        }
    }

 

GridControl取某一列的值

/*网格双击
 * MouseDoubleClick事件*/
    GridHitInfo hInfo = this.GridView.CalcHitInfo(new Point(e.X, e.Y));
    if (hInfo.InRow)
    {
        //取某列数据
        string value = http://www.mamicode.com/this.GridView.GetRowCellDisplayText(hInfo.RowHandle, "ColumnName");
    }