GridControl常用属性

来源:互联网 发布:博雅软件集团2017 编辑:程序博客网 时间:2024/06/05 17:56

            this.gridView1.OptionsView.ShowColumnHeaders = true;       //显示列标题
            this.gridView1.OptionsView.ShowIndicator = true;          // 显示行标题

            this.gridView1.IndicatorWidth = 40;                       //行标题宽度

            //显示行标题

             this.gridView1.CustomDrawRowIndicator += (s, e) =>
                {
                    e.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center;  //行号对齐方式
                    if (e.Info.IsRowIndicator && e.RowHandle >= 0)
                    {
                        e.Info.DisplayText = (e.RowHandle + 1).ToString();   //行号
                    }
                };

          

           this.gridView1.OptionsView.ShowGroupPanel = false;          // 不显示分组panel

            this.gridView1.OptionsView.ShowGroupedColumns = true;     //显示分组的列
            this.gridView1.OptionsView.ShowFilterPanelMode = ShowFilterPanelMode.Never;   //是否显示过滤面板
            this.gridView1.OptionsView.EnableAppearanceEvenRow = true;                    //是否启用偶数行外观
            this.gridView1.OptionsView.EnableAppearanceOddRow = true;                     //是否启用奇数行外观

            this.gridView1.OptionsCustomization.AllowFilter = true;                      //是否允许过滤
            this.gridView1.OptionsCustomization.AllowGroup = true;     //是否允许分组
            this.gridView1.OptionsCustomization.AllowColumnMoving = true;                //是否允许移动列
            this.gridView1.OptionsCustomization.AllowColumnResizing = false;              //是否允许调整列宽
            this.gridView1.OptionsCustomization.AllowSort = true;                          //是否允许排序

            this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false;           //是否允许选中单元格


            this.gridView1.OptionsBehavior.EditorShowMode = EditorShowMode.Click;//允许选中行,不允许编辑
            this.gridView1.OptionsBehavior.Editable = false;                               //是否允许用户编辑单元格

            this.gridView1.OptionsMenu.EnableColumnMenu = false;                          //禁用列标题右键菜单

            this.gridView1.ClearSorting();//清除排序
            this.gridView1.PaintStyleName = "Flat";   //设置外观样式
            //选中行设置
            this.gridView1.Appearance.FocusedRow.BackColor = Color.Green;   //选中的行
            this.gridView1.Appearance.FocusedCell.BackColor = Color.GreenYellow;  //选中的单元格
            this.gridView1.Appearance.FocusedRow.ForeColor = Color.Gray;   //字体颜色
            //空白区域颜色
            this.gridView1.Appearance.Empty.BackColor = Color.Gray;
            //列标题颜色

            this.gridView1.Appearance.HeaderPanel.BackColor = Color.Blue;

            

            //表格列在表格工具栏自动统计

            this.col.SummaryItem.DisplayFormat = "{0:#.##}"; //"共{0}笔"
            this.col.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum;

            或者this.col.SummaryItem.SetSummary(DevExpress.Data.SummaryItemType.Count, "共{0}笔");

原创粉丝点击