コード例 #1
0
        private Dictionary <string, MD_RGL_FieldDefine> CreateFieldDictionary(string _meta)
        {
            RegexOptions options  = RegexOptions.None;
            Regex        regeMeta = new Regex(@"<FN>[^<]{1,}</FN>", options);

            Dictionary <string, MD_RGL_FieldDefine> _ret = new Dictionary <string, MD_RGL_FieldDefine>();

            _ret.Add("ZBMC", new MD_RGL_FieldDefine("ZBMC", "Ö¸±ê", 0, 200));

            MatchCollection _mc = regeMeta.Matches(_meta);

            foreach (Match _m in _mc)
            {
                string   _s2 = _m.Value.Substring(4, _m.Length - 9);
                string[] _s3 = _s2.Split(':');
                if (_s3.Length > 1)
                {
                    MD_RGL_FieldDefine _item = new MD_RGL_FieldDefine(_s3[0],
                                                                      (_s3.Length > 1) ? _s3[1] : "",
                                                                      (_s3.Length > 2) ? int.Parse(_s3[2]) : 0,
                                                                      (_s3.Length > 3) ? int.Parse(_s3[3]) : 0);

                    _ret.Add(_s3[0], _item);
                }
            }

            return(_ret);
        }
コード例 #2
0
        private void CreateGridColumns(DataTable _zbData, Dictionary <string, MD_RGL_FieldDefine> fieldDict, DevExpress.XtraGrid.Views.Grid.GridView gridView)
        {
            gridView.Columns.Clear();
            List <MD_RGL_FieldDefine> _usedList = new List <MD_RGL_FieldDefine>();

            foreach (DataColumn _dc in _zbData.Columns)
            {
                if (fieldDict.ContainsKey(_dc.ColumnName))
                {
                    MD_RGL_FieldDefine _item = fieldDict[_dc.ColumnName];
                    _usedList.Add(_item);
                }
            }

            _usedList.Sort(new Comparer_RGL_FieldDefine());
            int _index = 0;

            foreach (MD_RGL_FieldDefine _item in _usedList)
            {
                GridColumn _gc = gridView.Columns.Add();
                _gc.FieldName = _item.FieldName;
                _gc.Caption   = _item.DisplayName;
                _gc.Width     = (_item.DisplayWidth > 10) ? _gc.Width : 10;
                _gc.OptionsColumn.ReadOnly = true;
                _gc.Visible      = true;
                _gc.VisibleIndex = _index++;
            }
        }