C# superGridControl 样式设置、加载数据、获取数据
样式设置
superGridControl1.PrimaryGrid.SelectionGranularity = SelectionGranularity.Cell; //设置选中样式 单元格、整列、单元格和整列
superGridControl1.PrimaryGrid.MultiSelect = false; //设置是否可以选中多行
superGridControl1.PrimaryGrid.RowDragBehavior = RowDragBehavior.None;
superGridControl1.PrimaryGrid.EnableCellMerging = true;
superGridControl1.PrimaryGrid.ShowRowGridIndex = true;//显示行号
superGridControl1.PrimaryGrid.AllowRowHeaderResize = true;//允许调整行头的宽度
superGridControl1.PrimaryGrid.ShowRowHeaders = false; //不允许显示行头
superGridControl1.PrimaryGrid.EnableFiltering = true; superGridControl1.PrimaryGrid.EnableColumnFiltering = true;//让列头显示筛选图标
superGridControl1.PrimaryGrid.RowHeaderIndexOffset = ;//设置行号的开始值
this.superGridControl1.PrimaryGrid.Filter.Visible = true;//显示Filter
this.superGridControl1.PrimaryGrid.GroupByRow.Visible = true; //允许按列分组
// GridPanel panel = superGridControl1.PrimaryGrid; panel.SetGroup(panel.Columns["Period"]);//使用分组
SPG.PrimaryGrid.ShowRowGridIndex = false;//设置行号
SPG.PrimaryGrid.SelectionGranularity = SelectionGranularity.Row;
SPG.BackColor = Color.FromArgb(, , );//设置控件的整个背景颜色不包含显示内容
SPG.PrimaryGrid.DefaultVisualStyles.GridPanelStyle.Background.Color1 = Color.FromArgb(, , );
SPG.PrimaryGrid.DefaultRowHeight = ;
SPG.PrimaryGrid.ShowRowHeaders = false;
SPG.PrimaryGrid.AllowEdit = false;
SPG.DefaultVisualStyles.ColumnHeaderStyles.Default.Background.Color1 = Color.FromArgb(, , );//设置背景颜色紧紧加载的内容
SPG.DefaultVisualStyles.ColumnHeaderStyles.Default.Background.Color2 = Color.FromArgb(, , );//设置背景颜色紧紧加载的内容
SPG.DefaultVisualStyles.ColumnHeaderStyles.Default.TextColor = Color.White; SPG.DefaultVisualStyles.CellStyles.Default.Alignment = DevComponents.DotNetBar.SuperGrid.Style.Alignment.MiddleCenter;//设置列头文字居中问题
加载数据
未设置列的情况下直接绑定数据源
DataRow DR = DTS.NewRow();
DR["调研代码"] = "1";
DR["调研序列"] = "2";
DR["调研维度"] = "3";
DR["维度说明"] = "4";
DR["核算单元1"] = "5";
DR["核算单元2"] = "6";
DTS.Rows.Add(DR);
superGridControl1.PrimaryGrid.DataSource = DTS;
当然在绑定列的情况下 如下 也可以绑定数据源
GridColumn col = new GridColumn();
col = new GridColumn();
col.Name = "调研代码";
col.HeaderText = "调研代码";
col.EditorType = typeof(GridLabelXEditControl);
col.FilterMatchType = FilterMatchType.RegularExpressions;
col.CellMergeMode = CellMergeMode.None;
col.AutoSizeMode = ColumnAutoSizeMode.None;
col.Visible = false;
superGridControl1.PrimaryGrid.Columns.Add(col);
col = new GridColumn();
col.Name = "调研序列";
col.HeaderText = "调研序列";
col.EditorType = typeof(GridLabelXEditControl);
col.FilterMatchType = FilterMatchType.RegularExpressions;
col.CellMergeMode = CellMergeMode.None;
col.AutoSizeMode = ColumnAutoSizeMode.None;
superGridControl1.PrimaryGrid.Columns.Add(col);
col = new GridColumn();
col.Name = "调研维度";
col.HeaderText = "调研维度";
col.EditorType = typeof(GridLabelXEditControl);
col.FilterMatchType = FilterMatchType.RegularExpressions;
col.CellMergeMode = CellMergeMode.None;
col.AutoSizeMode = ColumnAutoSizeMode.None;
superGridControl1.PrimaryGrid.Columns.Add(col);
col = new GridColumn();
col.Name = "维度说明";
col.HeaderText = "维度说明";
col.EditorType = typeof(GridLabelXEditControl);
col.FilterMatchType = FilterMatchType.RegularExpressions;
col.CellMergeMode = CellMergeMode.None;
col.AutoSizeMode = ColumnAutoSizeMode.None;
superGridControl1.PrimaryGrid.Columns.Add(col);
col = new GridColumn();
col.Name = "核算单元1";
col.HeaderText = "核算单元1";
col.EditorType = typeof(GridLabelXEditControl);
col.FilterMatchType = FilterMatchType.RegularExpressions;
col.CellMergeMode = CellMergeMode.None;
col.AutoSizeMode = ColumnAutoSizeMode.None;
superGridControl1.PrimaryGrid.Columns.Add(col);
col = new GridColumn();
col.Name = "核算单元2";
col.HeaderText = "核算单元2";
col.EditorType = typeof(GridLabelXEditControl);
col.FilterMatchType = FilterMatchType.RegularExpressions;
col.CellMergeMode = CellMergeMode.None;
col.AutoSizeMode = ColumnAutoSizeMode.None;
superGridControl1.PrimaryGrid.Columns.Add(col);
//一行行加载并设置样式 (这种方法比较灵活)
if (DTmain.Rows.Count > )
{
GridRow gr = null;
foreach (DataRow dr in DTmain.Rows)
{
gr = new GridRow(new object[] {
(dr["操作名称"]??"").ToString().Trim(),
(dr["反馈消息"]??"").ToString().Trim(),
(dr["导入条数"]??"").ToString().Trim(),
(dr["导入时间段起"]??"").ToString().Trim(),
(dr["导入时间段止"]??"").ToString().Trim(),
(dr["日志添加时间"]??"").ToString().Trim()
});
gr.CellStyles.Default.Font = new Font("微软雅黑", );
gr.CellStyles.Default.TextColor = Color.White;
SPG.PrimaryGrid.Rows.Add(gr);
}
}
supergridcontrol 样式附加
SPG.DefaultVisualStyles.ColumnHeaderStyles.Default.Background.Color1 = Color.FromArgb(8, 47, 76); //设置列的背景颜色
SPG.DefaultVisualStyles.CellStyles.Default.Alignment = DevComponents.DotNetBar.SuperGrid.Style.Alignment.MiddleCenter //设置单元格文本居中
SPG.DefaultVisualStyles.CellStyles.Default.AllowWrap = Tbool.True;//可自动换行
SPG.DefaultVisualStyles.CellStyles.Selected.AllowWrap = Tbool.True;
注意:设置单元格的相关属性一般CellStyles,行样式用rowStyle
supergridcontrol 在样式上同比其他的控件更加美观,但是在加载速度上不如datageidview 该控件在追求样式的时候丢失了 数据加载速度。
supergridcontrol.cellclik事件中删除所选行 IsDeleted = true;删除行信息,或者supertgridcontrol.PrimaryGrid.Rows.Remove(gr); 这种方式保险点,iddeleted貌似与样式稍微有点冲突,建议用第二种方式。
C# superGridControl 样式设置、加载数据、获取数据的更多相关文章
- jsTree 的简单用法--异步加载和刷新数据
首先这两个文件是必须要引用的,还有就是引用 jQuery 文件就不说了: <link href="/css/plugins/jsTree/style.min.css" rel ...
- js设置加载进度提示
CreateTime--2017年8月23日09:17:46Author:Marydon js设置加载进度提示 第一部分:CSS /*加载样式*/ .Loading { position: abs ...
- 使用getJSON()方法异步加载JSON格式数据
使用getJSON()方法异步加载JSON格式数据 使用getJSON()方法可以通过Ajax异步请求的方式,获取服务器中的数组,并对获取的数据进行解析,显示在页面中,它的调用格式为: jQuery. ...
- hive 压缩全解读(hive表存储格式以及外部表直接加载压缩格式数据);HADOOP存储数据压缩方案对比(LZO,gz,ORC)
数据做压缩和解压缩会增加CPU的开销,但可以最大程度的减少文件所需的磁盘空间和网络I/O的开销,所以最好对那些I/O密集型的作业使用数据压缩,cpu密集型,使用压缩反而会降低性能. 而hive中间结果 ...
- 加载的DAL数据访问层的类型
using System; using System.Collections; using System.Reflection; using CSFrameworkV4_5.Core; using C ...
- [原创.数据可视化系列之三]使用Ol3加载大量点数据
不管是百度地图还是高德地图,都很难得见到在地图上加载大量点要素,比如同屏1000的,因为这样客户端性能会很低,尤其是IE系列的浏览器,简直是卡的要死.但有的时候,还真的需要,比如,我要加载全球的AQI ...
- 异步加载回来的数据不受JS控制了
写成下面这种方式时,异步加载回来的数据不受JS控制 $(."orderdiv").click(function(){ $(this).find(".orderinfo&q ...
- echarts 图表重新加载,原来的数据依然存在图表上
问题 在做一个全国地图上一些饼图,并且向省一级的地图钻取的时候,原来的饼图依然显示 原因 echars所有添加的图表都在一个series属性集合中,并且同一个echars对象默认是合并之前的数据的,所 ...
- mxnet自定义dataloader加载自己的数据
实际上关于pytorch加载自己的数据之前有写过一篇博客,但是最近接触了mxnet,发现关于这方面的教程很少 如果要加载自己定义的数据的话,看mxnet关于mnist基本上能够推测12 看pytorc ...
- 实用ExtJS教程100例-010:ExtJS Form异步加载和提交数据
ExtJS Form 为我们提供了两个方法:load 和 submit,分别用来加载和提交数据,这两个方法都是异步的. 系列ExtJS教程持续更新中,点击查看>>最新ExtJS教程目录 F ...
随机推荐
- python mysql模块
多次使用python操作mysql数据库,先与大家分享一下,关于如何使用python操作mysql数据库.mysql并不是python自带的模块,因此需要下载安装.(在windows平台下介绍该使用过 ...
- 测试工具-PICT-微软基于数据项多个取值的正交法用例生成工具
下载 http://download.microsoft.com/download/f/5/5/f55484df-8494-48fa-8dbd-8c6f76cc014b/pict33.msi 这里使用 ...
- 项目管理工具maven(一)
1 Maven的概述 1.1 依赖管理 就是对jar包的统一管理 可以节省空间 1.2 项目一键构建 编码 编译 测试(junit) 运行 打包 部署 一个 tomcat:run就能把项目 ...
- 【转】楼天城楼教主的acm心路历程(作为励志用)
利用假期空闲之时,将这几年GCJ,ACM,TopCoder 参加的一些重要比赛作个回顾.昨天是GCJ2006 的回忆,今天时间上更早一些吧,我现在还清晰记得3 年前,我刚刚参加ACM 时参加北京赛区2 ...
- python中numpy计算数组的行列式numpy.linalg.det()
numpy.linalg.det numpy.linalg.det(a)[source] 计算任何一个数组a的行列式,但是这里要求数组的最后两个维度必须是方阵. 参数: a : (..., M, M) ...
- cp & scp
[cp & scp] Linux为我们提供了两个用于文件copy的命令,一个是cp,一个是scp,但是他们略有不同. cp --- 主要是用于在同一台电脑上,在不同的目录之间来回copy文 ...
- springmvc+mybaits一个事物同时update和调用存储过程异常回滚
事物作用的impl类这样写的 @Override public int updateReturnAll(int item, int status, int idUser) { // TODO Auto ...
- 第一个独特字符位置 · first position unique character
[抄题]: 给出一个字符串.找到字符串中第一个不重复的字符然后返回它的下标.如果不存在这样的字符,返回 -1. 给出字符串 s = "lintcode",返回 0.给出字符串 s ...
- weblogic 初始化
weblogic无法启动,或是忘记了登陆密码,需要初始化,可以删除weblogic配置然后重新生成配置.步骤如下 1> 找到weblogic的启动路径,打开jdeveloper,run后,查看日 ...
- C#获取mp3文件时长、解决发布到服务器无法使用问题
首先引用COM组件:Microsoft Shell Controls And Automation,需要引用1.2版本的,1.0的会出问题. 这里需要注意DLL的属性Embed Interop Typ ...