Ejemplo n.º 1
0
 /// <summary>
 /// 格式化编辑的列。
 /// </summary>
 /// <param name="gridColumn"></param>
 /// <param name="colPropertyInfo"></param>
 /// <param name="columnName"></param>
 protected virtual void FormatColumn(DevExpress.XtraTreeList.Columns.TreeListColumn gridColumn,
                                     MB.WinBase.Common.ColumnPropertyInfo colPropertyInfo, string columnName, bool allowEdit)
 {
     gridColumn.Caption = colPropertyInfo.Description;
     if (columnName != null)
     {
         gridColumn.FieldName = columnName;
     }
     else
     {
         gridColumn.FieldName = colPropertyInfo.Name;
     }
     gridColumn.Name  = "XtCol" + colPropertyInfo.Name;
     gridColumn.Width = colPropertyInfo.VisibleWidth;
     if (colPropertyInfo.Visibled && colPropertyInfo.VisibleWidth > 0)
     {
         gridColumn.VisibleIndex = colPropertyInfo.OrderIndex;
     }
     else
     {
         gridColumn.VisibleIndex = -1;
     }
     gridColumn.OptionsColumn.AllowEdit  = allowEdit;
     gridColumn.OptionsColumn.ReadOnly   = !allowEdit;
     gridColumn.OptionsColumn.AllowFocus = false;
 }
Ejemplo n.º 2
0
        //设置汇总显示的信息
        public void SetGroupSummary(DevExpress.XtraGrid.Views.Grid.GridView gridView, Dictionary<string, MB.WinBase.Common.ColumnPropertyInfo> colPropertys) {
            ArrayList list = new ArrayList();

            foreach (DevExpress.XtraGrid.Columns.GridColumn dc in gridView.Columns) {
                int num;
                string name = string.Empty;
                if (!string.IsNullOrEmpty(colPropertys.Keys.FirstOrDefault(o => string.Compare(o, dc.FieldName, true) == 0))) {
                    name = dc.FieldName;
                }
                else {
                    name = interceptRightNumber(dc.FieldName, out num);
                }
                MB.WinBase.Common.ColumnPropertyInfo info = null;
                if (colPropertys.ContainsKey(name))
                    info = colPropertys[name];
                if (info != null && info.SummaryItem) {
                    //设置Total 汇总的信息
                    dc.SummaryItem.SummaryType = (DevExpress.Data.SummaryItemType)Enum.Parse(typeof(DevExpress.Data.SummaryItemType), info.SummaryItemType.ToString());
                    dc.SummaryItem.DisplayFormat = getSummmaryDisplayCaption(dc.SummaryItem.SummaryType) + "={0}";
                    //为了设置小计的显示而存储
                    list.Add(dc);
                }
                // 处理动态创建的列.
                if (info == null && dc.Tag != null) {
                    switch (dc.Tag.ToString()) {
                        case "System.Int32":
                        case "System.Decimal":
                            dc.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum;
                            dc.SummaryItem.DisplayFormat = getSummmaryDisplayCaption(dc.SummaryItem.SummaryType) + "={0}";
                            list.Add(dc);
                            break;
                        default:
                            break;
                    }
                }
            }
            if (list.Count > 0) {
                List<DevExpress.XtraGrid.GridSummaryItem> summaryItems = new List<GridSummaryItem>();
                for (int i = 0; i < list.Count; i++) {
                    DevExpress.XtraGrid.Columns.GridColumn dc = list[i] as DevExpress.XtraGrid.Columns.GridColumn;
                    if (dc != null) {
                        var sumItem = new DevExpress.XtraGrid.GridGroupSummaryItem(dc.SummaryItem.SummaryType, dc.FieldName, dc, getSummmaryDisplayCaption(dc.SummaryItem.SummaryType) + "={0}");
                        var gsumItem = new DevExpress.XtraGrid.GridGroupSummaryItem(dc.SummaryItem.SummaryType, dc.FieldName, null, getSummmaryDisplayCaption(dc.SummaryItem.SummaryType) + "={0}");
                        summaryItems.Add(sumItem);
                        summaryItems.Add(gsumItem);
                    }
                }
                gridView.GroupSummary.AddRange(summaryItems.ToArray());
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        ///  ComboBox 控件绑定(包含编码和名称的 ComboBox 绑定项)
        /// </summary>
        /// <param name="ctl"></param>
        /// <param name="propertyName"></param>
        /// <param name="columnEditInfoList"></param>
        public void FillComboxLookUp(Control ctl, string propertyName, Dictionary <string, MB.WinBase.Common.ColumnPropertyInfo> editCfgColumns, Dictionary <string, MB.WinBase.Common.ColumnEditCfgInfo> columnEditInfoList, bool mustInsertNullRow)
        {
            if (ctl is ComboBox && columnEditInfoList.ContainsKey(propertyName))
            {
                ComboBox cob = ctl as ComboBox;
                MB.WinBase.Common.ColumnPropertyInfo colCfg = null;
                if (editCfgColumns != null)
                {
                    colCfg = editCfgColumns[propertyName];
                }

                MB.WinBase.Common.ColumnEditCfgInfo cfgInfo = columnEditInfoList[propertyName];
                if (cfgInfo.SaveLocalCache)
                {
                    if (cfgInfo.DataSource == null)
                    {
                        return;
                    }

                    cob.DisplayMember = cfgInfo.TextFieldName;
                    cob.ValueMember   = cfgInfo.ValueFieldName;
                    DataTable dtData  = MB.Util.MyConvert.Instance.ToDataTable(cfgInfo.DataSource, string.Empty);
                    DataTable newData = dtData.Copy();
                    if (mustInsertNullRow || cfgInfo.InsertNullItem)
                    {
                        DataRow newDr = newData.NewRow();
                        if (colCfg != null)
                        {
                            if (string.Compare(colCfg.DataType, "System.String", true) == 0)
                            {
                                newDr[cfgInfo.ValueFieldName] = "";
                            }
                            else if (string.Compare(colCfg.DataType, "System.Int32", true) == 0 || string.Compare(colCfg.DataType, "System.Decimal", true) == 0)
                            {
                                newDr[cfgInfo.ValueFieldName] = 0;
                            }
                        }
                        newData.Rows.InsertAt(newDr, 0);
                    }

                    cob.DataSource = newData.DefaultView;
                }
                else
                {
                    //以后再处理
                    MB.Util.TraceEx.Write("ColumnEditCfgInfo 配置成 ComboBox 必须把 SaveLocalCache 设置为True,为 False 的情况目前还没有进行处理。");
                }
            }
        }
Ejemplo n.º 4
0
 public void SetColumn(DevExpress.XtraGrid.Columns.GridColumn gridColumn, MB.WinBase.Common.ColumnPropertyInfo colPropertyInfo, string columnName) {
     gridColumn.Caption = colPropertyInfo.Description;
     if (columnName != null) {
         gridColumn.FieldName = columnName;
     }
     else {
         gridColumn.FieldName = colPropertyInfo.Name;
     }
     //SetColumnDisplayFormat(gridColumn, colPropertyInfo);
     gridColumn.Name = "XtCol" + colPropertyInfo.Name;
     gridColumn.Width = colPropertyInfo.VisibleWidth;
     if (colPropertyInfo.Visibled && colPropertyInfo.VisibleWidth > 0) {
         gridColumn.VisibleIndex = colPropertyInfo.OrderIndex;
     }
     else {
         gridColumn.VisibleIndex = -1;
     }
     //pColumn.OptionsFilter.AllowFilter = false;
     gridColumn.OptionsColumn.ReadOnly = string.Compare(colPropertyInfo.DataType, "System.Byte[]", true) == 0;
     gridColumn.OptionsColumn.AllowEdit = string.Compare(colPropertyInfo.DataType, "System.Byte[]", true) == 0;
 }
Ejemplo n.º 5
0
        /// <summary>
        /// ComboCheckListBox 数据绑定。
        /// </summary>
        /// <param name="ctl"></param>
        /// <param name="propertyName"></param>
        /// <param name="editCfgColumns"></param>
        /// <param name="columnEditInfoList"></param>
        public void FillComboCheckListBox(Control ctl, string propertyName, Dictionary <string, MB.WinBase.Common.ColumnPropertyInfo> editCfgColumns, Dictionary <string, MB.WinBase.Common.ColumnEditCfgInfo> columnEditInfoList)
        {
            bool check = ctl is MB.WinBase.Ctls.ucComboCheckedListBox && columnEditInfoList.ContainsKey(propertyName);

            if (!check)
            {
                return;
            }

            MB.WinBase.Ctls.ucComboCheckedListBox cob    = ctl as MB.WinBase.Ctls.ucComboCheckedListBox;
            MB.WinBase.Common.ColumnPropertyInfo  colCfg = null;
            if (editCfgColumns != null)
            {
                colCfg = editCfgColumns[propertyName];
            }

            MB.WinBase.Common.ColumnEditCfgInfo cfgInfo = columnEditInfoList[propertyName];
            if (cfgInfo.SaveLocalCache)
            {
                if (cfgInfo.DataSource == null)
                {
                    return;
                }

                cob.DisplayMember = cfgInfo.TextFieldName;
                cob.ValueMember   = cfgInfo.ValueFieldName;
                DataTable dtData = MB.Util.MyConvert.Instance.ToDataTable(cfgInfo.DataSource, string.Empty);


                cob.DataSource = dtData;
            }
            else
            {
                //以后再处理
                MB.Util.TraceEx.Write("ColumnEditCfgInfo 配置成 ucComboCheckedListBox 必须把 SaveLocalCache 设置为True,为 False 的情况目前还没有进行处理。");
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 ///  construct function...
 /// </summary>
 /// <param name="columnName"></param>
 /// <param name="columnPropertyInfo"></param>
 /// <param name="bindingControl"></param>
 public ColumnBindingInfo(string columnName, MB.WinBase.Common.ColumnPropertyInfo columnPropertyInfo, System.Windows.Forms.Control bindingControl)
 {
     _ColumnName         = columnName;
     _ColumnPropertyInfo = columnPropertyInfo;
     _BindingControl     = bindingControl;
 }
 private int colPropertyOrderByIndex(MB.WinBase.Common.ColumnPropertyInfo x, MB.WinBase.Common.ColumnPropertyInfo y)
 {
     return((new CaseInsensitiveComparer()).Compare(x.OrderIndex, y.OrderIndex));
 }
Ejemplo n.º 8
0
        private void ctlDataBingByCtlName(Dictionary <string, MB.WinBase.Common.ColumnPropertyInfo> editCfgColumns, string[] dataPropertys,
                                          System.Windows.Forms.BindingSource bindingSource,
                                          System.Windows.Forms.Control.ControlCollection ctls,
                                          DataBindingOptions bindingOptions,
                                          List <ColumnBindingInfo> bindingDatas,
                                          Dictionary <string, MB.WinBase.Common.ColumnEditCfgInfo> columnEditInfoList)
        {
            foreach (Control ctl in ctls)
            {
                string ctlTypeName = ctl.GetType().Name;
                if (_DESCRIPTION_CONTROLS.Contains <string>(ctlTypeName))
                {
                    continue;
                }

                if (_CONTAINER_CONTROLS.Contains(ctlTypeName))
                {
                    ctlDataBingByCtlName(editCfgColumns, dataPropertys, bindingSource, ctl.Controls, bindingOptions, bindingDatas, columnEditInfoList);
                    continue;
                }
                string sName = ctl.Name;

                if (sName.Length < MIN_CTL_NAME_LENGTH)
                {
                    MB.Util.TraceEx.Write("在执行BindingSourceEx.SetDataSource 方法时,控件" + sName + "的命名方式至少要大于" + MIN_CTL_NAME_LENGTH + "个字符。该控件以及所在的ChildControl将不进行处理,请检查。",
                                          MB.Util.APPMessageType.SysWarning);
                }
                if (sName.Length <= MIN_CTL_NAME_LENGTH)
                {
                    ctlDataBingByCtlName(editCfgColumns, dataPropertys, bindingSource, ctl.Controls, bindingOptions, bindingDatas, columnEditInfoList);
                    continue;
                }
                //获取控件需要进行绑定的属性名称。
                string ctlBindingName   = getCtlBindingPropertyName(ctl);
                string dataPropertyName = sName.Substring(CTL_LEFT_PREX_LENGTH, sName.Length - CTL_LEFT_PREX_LENGTH);
                if (Array.IndexOf <string>(dataPropertys, dataPropertyName) < 0)
                {
                    continue;
                }

                if (editCfgColumns != null && editCfgColumns.ContainsKey(dataPropertyName))
                {
                    MB.WinBase.Common.ColumnPropertyInfo colCfg = editCfgColumns[dataPropertyName];
                    ColumnBindingInfo ctlBinding = new ColumnBindingInfo(dataPropertyName, colCfg, ctl);
                    bindingDatas.Add(ctlBinding);
                }
                System.Windows.Forms.Binding binding = new System.Windows.Forms.Binding(ctlBindingName, bindingSource,
                                                                                        dataPropertyName, false, DataSourceUpdateMode.OnValidation);

                //编辑界面的数据绑定分3步来完成

                //1,先绑定ComboBox 的数据源
                if (columnEditInfoList != null && columnEditInfoList.Count > 0)
                {
                    FillComboxLookUp(ctl, dataPropertyName, editCfgColumns, columnEditInfoList, false);
                }
                //2,绑定点击选择数据的数据源

                //3,控件编辑绑定
                ctl.DataBindings.Add(binding);
            }
        }
Ejemplo n.º 9
0
 private void formateBindControl(Control editCtl, System.Windows.Forms.Binding binding, MB.WinBase.Common.ColumnPropertyInfo colCfg)
 {
     if (string.Compare(colCfg.DataType, "System.DateTime?", true) == 0)
     {
         DateTimePicker date = editCtl as DateTimePicker;
         if (date != null)
         {
             binding.BindingComplete += new BindingCompleteEventHandler(binding_BindingComplete);
             date.ShowCheckBox        = true;
         }
     }
     else if (string.Compare(colCfg.DataType, "System.Decimal", true) == 0 && colCfg.IsFormatControl)
     {
         NumericUpDown num = editCtl as NumericUpDown;
         if (num != null)
         {
             num.ThousandsSeparator = colCfg.ThousandsSeperator;
             num.DecimalPlaces      = colCfg.MaxDecimalPlaces;
         }
     }
 }
Ejemplo n.º 10
0
        //绑定ButtonClick

        #region 内部函数处理...


        //控件编辑绑定。
        private void ctlDataBingByDataBinding(Dictionary <string, MB.WinBase.Common.ColumnPropertyInfo> editCfgColumns, string[] dataPropertys,
                                              System.Windows.Forms.BindingSource bindingSource,
                                              MB.WinBase.Binding.IDataBindingProvider dataBindingProvider,
                                              DataBindingOptions bindingOptions,
                                              List <ColumnBindingInfo> bindingDatas,
                                              Dictionary <string, MB.WinBase.Common.ColumnEditCfgInfo> columnEditInfoList)
        {
            if (dataBindingProvider == null || dataBindingProvider.DataBindings == null || dataBindingProvider.DataBindings.Count == 0)
            {
                return;
            }

            Dictionary <Control, DesignColumnXmlCfgInfo> bindingCtls = dataBindingProvider.DataBindings;

            foreach (Control ctl in bindingCtls.Keys)
            {
                string ctlTypeName = ctl.GetType().Name;
                if (_DESCRIPTION_CONTROLS.Contains <string>(ctlTypeName))
                {
                    continue;
                }

                string ctlBindingName   = getCtlBindingPropertyName(ctl);
                string dataPropertyName = bindingCtls[ctl].ColumnName;
                if (Array.IndexOf <string>(dataPropertys, dataPropertyName) < 0)
                {
                    continue;
                }

                MB.WinBase.Common.ColumnPropertyInfo colCfg = null;
                if (editCfgColumns.ContainsKey(dataPropertyName))
                {
                    colCfg = editCfgColumns[dataPropertyName];
                }

                if (editCfgColumns != null && editCfgColumns.ContainsKey(dataPropertyName))
                {
                    //特殊处理,绑定到特殊的控件。
                    ColumnBindingInfo ctlBinding = new ColumnBindingInfo(dataPropertyName, colCfg, ctl);
                    if (!colCfg.CanEdit)
                    {
                        setEditControlReadonly(ctl, true);
                    }

                    //如果是string 类型 并且设置MacLength 同时绑订的是TextBox 控件,那么就限制它的输入长度
                    if (string.Compare(colCfg.DataType, "System.String", true) == 0)
                    {
                        TextBox txtBox = ctl as TextBox;
                        if (txtBox != null && colCfg.MaxLength > 0)
                        {
                            txtBox.MaxLength = colCfg.MaxLength;
                        }
                    }
                    bindingDatas.Add(ctlBinding);
                }


                System.Windows.Forms.Binding binding = new System.Windows.Forms.Binding(ctlBindingName, bindingSource,
                                                                                        dataPropertyName, true, DataSourceUpdateMode.OnPropertyChanged); //DataSourceUpdateMode.OnValidation

                if (colCfg != null)
                {
                    formateBindControl(ctl, binding, colCfg);
                }
                //编辑界面的数据绑定分3步来完成

                //1,先绑定ComboBox 的数据源
                if (columnEditInfoList != null && columnEditInfoList.Count > 0)
                {
                    FillComboxLookUp(ctl, dataPropertyName, editCfgColumns, columnEditInfoList, false);
                }

                //2,绑定点击选择数据的数据源
                if (columnEditInfoList != null && columnEditInfoList.ContainsKey(dataPropertyName))
                {
                    bindingToSpecialEditCtl(ctl, columnEditInfoList[dataPropertyName]);
                }

                //3,控件编辑绑定
                ctl.DataBindings.Add(binding);
            }
        }
Ejemplo n.º 11
0
        //通过配置的PivotList 设置PivotField 的信息
        private Dictionary <DevExpress.XtraPivotGrid.PivotGridField, ColPivotInfo> setPivotFieldByCfg(ColPivotList xmlCfgLst, DevExpress.XtraPivotGrid.PivotGridControl gridCtl,
                                                                                                      MB.WinBase.Common.ColumnPropertyInfo fieldInfo)
        {
            if (xmlCfgLst == null)
            {
                return(null);
            }
            if (xmlCfgLst.Columns.Count == 0 && !xmlCfgLst.AutoCreatedGridField)
            {
                return(null);
            }

            IList <MB.XWinLib.PivotGrid.ColPivotInfo> infos = xmlCfgLst.GetColPivotInfos(fieldInfo.Name);

            DevExpress.XtraPivotGrid.PivotGridGroup pivotGridGroup = null;
            if (infos.Count > 1 && xmlCfgLst.SameFieldGroup)
            {
                pivotGridGroup = new DevExpress.XtraPivotGrid.PivotGridGroup();
                gridCtl.Groups.Add(pivotGridGroup);
            }
            if (infos.Count == 0)
            {
                createNewPivotField(fieldInfo.Name, fieldInfo.Description, gridCtl);
                //add by aifang 去掉汇总后金额显示格式(原来不管是金额还是数量都显示¥前缀)begin
                if (fieldInfo.DataType.Equals("System.Decimal"))
                {
                    gridCtl.Fields[fieldInfo.Name].CellFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                }
                //add by aifang end
                return(null);
            }
            else
            {
                Dictionary <DevExpress.XtraPivotGrid.PivotGridField, ColPivotInfo> expressionFields =
                    new Dictionary <DevExpress.XtraPivotGrid.PivotGridField, ColPivotInfo>();


                //处理一个字段对应多个分组的情况
                foreach (ColPivotInfo info in infos)
                {
                    DevExpress.XtraPivotGrid.PivotGridField pivField = createNewPivotField(fieldInfo.Name, fieldInfo.Description, gridCtl);
                    //如果定义了Expression则表示该列的值是通过其他列或其他手段推算而出的
                    if (!string.IsNullOrEmpty(info.Expression))
                    {
                        expressionFields.Add(pivField, info);
                    }

                    if (info.Description != null && info.Description.Length > 0)
                    {
                        pivField.Caption = info.Description;
                    }

                    pivField.Area          = info.IniArea;
                    pivField.AreaIndex     = info.AreaIndex;
                    pivField.AllowedAreas  = info.AllowedAreas;
                    pivField.TopValueCount = info.TopValueCount;
                    pivField.GroupInterval = info.GroupInterval;

                    if (info.SummaryItemType != null && info.SummaryItemType.Length > 0)
                    {
                        pivField.SummaryType = (DevExpress.Data.PivotGrid.PivotSummaryType)Enum.Parse(typeof(DevExpress.Data.PivotGrid.PivotSummaryType), info.SummaryItemType);
                    }

                    //setDefaultFormatByGroup(pivField);
                    //格式化显示数据。
                    if (info.CellFormat != DevExpress.Utils.FormatInfo.Empty)
                    {
                        pivField.CellFormat.Format       = info.CellFormat.Format;
                        pivField.CellFormat.FormatType   = info.CellFormat.FormatType;
                        pivField.CellFormat.FormatString = info.CellFormat.FormatString;
                    }
                    if (info.ValueFormat != DevExpress.Utils.FormatInfo.Empty)
                    {
                        pivField.ValueFormat.Format       = info.CellFormat.Format;
                        pivField.ValueFormat.FormatType   = info.CellFormat.FormatType;
                        pivField.ValueFormat.FormatString = info.CellFormat.FormatString;
                    }
                    //加入字段绑定分组。
                    if (pivotGridGroup != null)
                    {
                        pivotGridGroup.Add(pivField);
                    }
                    //DevExpress.XtraPivotGrid.PivotGroupInterval.DateDayOfWeek
                }
                return(expressionFields);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 设置列显示格式
        /// </summary>
        /// <param name="gridColumn"></param>
        /// <param name="colLayoutInfo"></param>
        public void SetColumnDisplayFormat(DevExpress.XtraGrid.Columns.GridColumn gridColumn, MB.WinBase.Common.ColumnPropertyInfo columnPropertyInfo,
            MB.WinBase.Common.GridColumnLayoutInfo colLayoutInfo) {
             if (colLayoutInfo != null)
                gridColumn.Caption = string.IsNullOrEmpty(colLayoutInfo.Text) ? columnPropertyInfo.Description : colLayoutInfo.Text;

             if (colLayoutInfo.DisplayFormat == null) return;

             MB.WinBase.Common.FormatType fType = colLayoutInfo.DisplayFormat.FormatType;
             DevExpress.Utils.FormatType formatType = DevExpress.Utils.FormatType.None; //add by aifang
             switch (fType) {
                 case MB.WinBase.Common.FormatType.Numeric:
                     formatType = DevExpress.Utils.FormatType.Numeric; //add by aifang
                     gridColumn.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Numeric;
                     gridColumn.DisplayFormat.FormatString = colLayoutInfo.DisplayFormat.FormatString;
                     break;
                 case MB.WinBase.Common.FormatType.DateTime:
                     formatType = DevExpress.Utils.FormatType.DateTime; //add by aifang
                     gridColumn.DisplayFormat.FormatType = DevExpress.Utils.FormatType.DateTime;
                     if (!string.IsNullOrEmpty(colLayoutInfo.DisplayFormat.FormatString))
                         gridColumn.DisplayFormat.FormatString = colLayoutInfo.DisplayFormat.FormatString;
                     break;
                 case MB.WinBase.Common.FormatType.Custom:
                     formatType = DevExpress.Utils.FormatType.Custom; //add by aifang
                     gridColumn.DisplayFormat.FormatType = DevExpress.Utils.FormatType.Custom;
                     if (!string.IsNullOrEmpty(colLayoutInfo.DisplayFormat.FormatString))
                     {
                         gridColumn.DisplayFormat.FormatString = colLayoutInfo.DisplayFormat.FormatString;
                     }
                     break;
                 default:
                     break;
             }

            //add by aifang 支持明细中日期格式显示
             if (gridColumn.ColumnEdit != null)
             {
                 gridColumn.ColumnEdit.EditFormat.FormatType = formatType;
                 gridColumn.ColumnEdit.DisplayFormat.FormatType = formatType;

                 if (!string.IsNullOrEmpty(colLayoutInfo.DisplayFormat.FormatString))
                 {
                     gridColumn.ColumnEdit.DisplayFormat.FormatString = colLayoutInfo.DisplayFormat.FormatString;
                     gridColumn.ColumnEdit.EditFormat.FormatString = colLayoutInfo.DisplayFormat.FormatString;

                     if (fType == MB.WinBase.Common.FormatType.DateTime) {
                         //只有在日期类型的格式中,格式化日期
                         DevExpress.XtraEditors.Repository.RepositoryItemDateEdit dateItem = (DevExpress.XtraEditors.Repository.RepositoryItemDateEdit)gridColumn.ColumnEdit;
                         if (dateItem != null) dateItem.EditMask = colLayoutInfo.DisplayFormat.FormatString;
                     }
                 }
             }
            //end

             //背景颜色处理
             if (!string.IsNullOrEmpty(colLayoutInfo.BackColor)) {
                 Color bc = MB.Util.MyConvert.Instance.ToColor(colLayoutInfo.BackColor);
                 if (bc != Color.Empty) {
                     gridColumn.AppearanceHeader.BackColor = bc;
                 }
             }
             //字体颜色
             if (!string.IsNullOrEmpty(colLayoutInfo.ForeColor)) {
                 Color fc = MB.Util.MyConvert.Instance.ToColor(colLayoutInfo.ForeColor);
                 if (fc != Color.Empty) {
                     gridColumn.AppearanceHeader.ForeColor = fc;
                     gridColumn.AppearanceCell.ForeColor = fc;
                 }
             }
          
        }
Ejemplo n.º 13
0
 /// <summary>
 ///  设置显示列的样式 通过配置的XML文件
 /// </summary>
 /// <param name="pColumn"></param>
 /// <param name="pFieldInfo"></param>
 public void SetColumn(DevExpress.XtraGrid.Columns.GridColumn gridColumn, MB.WinBase.Common.ColumnPropertyInfo colPropertyInfo) {
     SetColumn(gridColumn, colPropertyInfo, null);
 }