コード例 #1
0
ファイル: frmCertification.cs プロジェクト: vhtrieu/HLTV
 private void SetGridFont(DevExpress.XtraGrid.Views.Base.BaseView baseView, Font sFont)
 {
     foreach (AppearanceObject ap in baseView.Appearance)
     {
         ap.Font = sFont;
     }
 }
コード例 #2
0
        /// <summary>
        /// 导出文件,多种格式选择
        /// </summary>
        /// <param name="gridView"></param>
        /// <param name="reportName"></param>
        /// <param name="fullFileName"></param>
        public static void ExportGridToFile(DevExpress.XtraGrid.Views.Base.BaseView gridView, string reportName, string fullFileName = null)
        {
            string fileName = string.Empty;

            if (string.IsNullOrEmpty(fullFileName))
            {
                System.Windows.Forms.SaveFileDialog dlg = new System.Windows.Forms.SaveFileDialog();
                dlg.DefaultExt   = ".xls";
                dlg.FileName     = reportName + "-" + DateTime.Now.ToString("yyyyMMddhhmmss");
                dlg.AddExtension = true;
                dlg.Filter       = "Excel2000-2003(*.xls)|*.xls|Excel2007以上(*.xlsx)|*.xlsx|PDF文件(*.pdf)|*.pdf|网页文件(*.html)|*.html|RTF文件(*.rtf)|*.rtf|文本文件(*.txt)|*.txt";
                if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    fileName = dlg.FileName;
                }
                else
                {
                    return;
                }
            }
            if (fileName == string.Empty)
            {
                return;
            }
            string extFileName = System.IO.Path.GetExtension(fileName).ToUpper();

            DevExpress.XtraPrinting.XlsExportOptions options = new DevExpress.XtraPrinting.XlsExportOptions();

            switch (extFileName)
            {
            case ".XLSX":
                gridView.ExportToXlsx(fileName);
                break;

            case ".PDF":
                gridView.ExportToPdf(fileName);
                break;

            case ".HTML":
                gridView.ExportToHtml(fileName);
                break;

            case ".RTF":
                gridView.ExportToRtf(fileName);
                break;

            case ".TXT":
                gridView.ExportToText(fileName);
                break;

            default:
                gridView.ExportToXls(fileName);
                break;
            }
            OpenFile(fileName);
        }
コード例 #3
0
        private void registerBinderFor <T>(DevExpress.XtraGrid.Views.Base.BaseView view, Func <GridViewBinder <T>, OptimizedParametersBinder> initBinding) where T : class
        {
            var dataSource = view.DataSource as IEnumerable <T>;

            if (!_optimizedParametersBinderCache.Contains(view))
            {
                var gridView = view.DowncastTo <GridView>();
                var binder   = new GridViewBinder <T>(gridView)
                {
                    BindingMode = BindingMode.OneWay
                };
                _optimizedParametersBinderCache.Add(gridView, initBinding(binder));
            }

            var gridViewBinder = _optimizedParametersBinderCache[view].GridViewBinder.DowncastTo <GridViewBinder <T> >();

            gridViewBinder.BindToSource(dataSource);
        }
コード例 #4
0
        private void registerBinderFor <T>(BaseView view, Action <GridViewBinder <T> > initBinding) where T : class
        {
            var dataSource = view.DataSource as IEnumerable <T>;

            if (!_cache.Contains(view))
            {
                var gridView = view.DowncastTo <GridView>();
                var binder   = new GridViewBinder <T>(gridView)
                {
                    BindingMode = BindingMode.OneWay
                };
                initBinding(binder);
                _cache.Add(gridView, binder);
            }

            var gridViewBinder = _cache[view].DowncastTo <GridViewBinder <T> >();

            gridViewBinder.BindToSource(dataSource);
        }
コード例 #5
0
        private RepositoryItem getTargetRepository(SchemaItemTargetDTO schemaItemTargetDTO, BaseView baseView)
        {
            var repositoryItemImageComboBox = new UxRepositoryItemImageComboBox(baseView, _imageListRetriever);

            repositoryItemImageComboBox.FillImageComboBoxRepositoryWith(_presenter.AllTargetsFor(schemaItemTargetDTO), s => _imageListRetriever.ImageIndex(s), _presenter.DisplayFor);
            return(repositoryItemImageComboBox);
        }