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 ...
随机推荐
- 如何在Solr中实现多core查询
基于solr或者elasticsearch提供的多核,多索引,多shard等查询能力,一般都是由lucene提供的多索引查询的功能演化而来的,这个功能在单机版的lucene里面确实没有发挥多大的威力, ...
- Electron 前端页面导入jQuery 出现错误Uncaught ReferenceError: jQuery is not defined
如下: <script src="../assets/js/jquery-1.10.2.js"></script> 方法1 改为: <script&g ...
- ggplot map
ggplot {ggplot2} R Documentation Create a new ggplot Description ggplot() initializes a ggplot objec ...
- Python之分布式监控系统开发
为什么要做监控? –熟悉IT监控系统的设计原理 –开发一个简版的类Zabbix监控系统 –掌握自动化开发项目的程序设计思路及架构解藕原则 常用监控系统设计讨论 Zabbix Nagios 监控系统需求 ...
- nginx错误页面重定向
一.Nginx错误页面优雅显示的原因? 当我们访问网站时,由于特殊的原因,经常会出现诸如403,404,503等错误,这极大的影响用户的访问体验,所以我们很有必要做一下错误页面的优雅显示,以提升用 ...
- sql注入及事务
Statement会有一个关于sql注入的bug ,所以基本不使用 一般使用PreparedStatement import java.sql.Connection;import java.sql.P ...
- python模块的打包
python模块的打包方法: http://blog.csdn.net/five3/article/details/7847551
- HDFS设计理念
[HDFS设计理念] 1. 读取整个数据集的时间延迟比读取第一条记录的延迟更重要. 2. HDFS以高延迟为代价,要求低时间延迟数据访问的应用,不适合在HDFS上运行. 3. namenode决定了集 ...
- SIEBEL GET最新时提示表异常
无法GET最新,则将此表GET一次,CHECK OUT下来,再UNDO CHECK IN即可
- SVG脚本编程简介
本文主要介绍SVG的脚本编程,并分别给出放大.缩小,查询,鼠标事件等实例. 一. SVG简介 SVG,全称为Scalable Vector Graphics(可伸缩矢量图形).它是W3C制定的.用矢量 ...