DotNetBar 中 SuperGridControl 加载数据、获取数据、设置样式
1.加载数据
构建列
//加载列
GridColumn gd = new GridColumn();
gd.Name = "第1";
gd.HeaderText = "第1"; superGridControl1.PrimaryGrid.Columns.Add(gd);
gd = new GridColumn();
gd.Name = "第2";
gd.HeaderText = "第2";
superGridControl1.PrimaryGrid.Columns.Add(gd);
gd = new GridColumn();
gd.Name = "第3";
gd.HeaderText = "第3";
superGridControl1.PrimaryGrid.Columns.Add(gd);
加载行
GridRow Dfr = superGridControl1.PrimaryGrid.NewRow();
Dfr[].Value = "";
Dfr[].Value = "";
Dfr[].Value = "";
superGridControl1.PrimaryGrid.Rows.Add(Dfr);
Dfr = superGridControl1.PrimaryGrid.NewRow();
Dfr[].Value = "";
Dfr[].Value = "";
Dfr[].Value = ""; superGridControl1.PrimaryGrid.Rows.Add(Dfr);
Dfr = superGridControl1.PrimaryGrid.NewRow();
Dfr[].Value = ""; superGridControl1.PrimaryGrid.Rows.Add(Dfr);
Dfr = superGridControl1.PrimaryGrid.NewRow();
Dfr[].Value = ""; superGridControl1.PrimaryGrid.Rows.Add(Dfr);
Dfr = superGridControl1.PrimaryGrid.NewRow();
Dfr[].Value = ""; superGridControl1.PrimaryGrid.Rows.Add(Dfr);
2.获取数据
// 获取某一行的信息
GridRow DG = this.superGridControl1.PrimaryGrid.Rows[] as GridRow;
//设置某一单元的背景颜色
DG[].CellStyles.Default.Background.Color1 = Color.Red;
//获取某一单元格的值
string Text = DG[0].values.tostring();
//获取选中单元整行数据
SelectedElementCollection col = this.superGridControl1.PrimaryGrid.GetSelectedRows();
//int /*/*sss*/*/ =int .Parse( superGridControl1.PrimaryGrid.SelectedCells as string );
if (col.Count > )
{
MessageBox.Show(col[].ToString());
}
3.设置样式
this.superGridControl1.PrimaryGrid.Filter.Visible = false;
/控制表格只能选中单行
superGridControl1.PrimaryGrid.MultiSelect = false;
superGridControl1.PrimaryGrid.InitialSelection = RelativeSelection.Row;
//只能选中一个单元格,而不是一行单元格
superGridControl1.PrimaryGrid.SelectionGranularity =SelectionGranularity.Row;
//是否显示序列号
superGridControl1.PrimaryGrid.ShowRowHeaders = false;
//自动填满表格
superGridControl1.PrimaryGrid.ColumnAutoSizeMode = ColumnAutoSizeMode.Fill;
//允许单元格拖动成为集合组
superGridControl1.PrimaryGrid.ColumnHeader.AllowSelection = true;
superGridControl1.PrimaryGrid.GroupByRow.Visible = false; GridPanel panel = superGridControl1.PrimaryGrid;
//设置表格自动展开
panel.AutoExpandSetGroup = true;
panel.SetGroup(panel.Columns["工作单位"]); //设置表格中文字的位置居中
superGridControl1.PrimaryGrid.DefaultVisualStyles.CellStyles.Default.Alignment= DevComponents.DotNetBar.SuperGrid.Style.Alignment.MiddleCenter;
加载图片
FileStream fs = new FileStream(str, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
//转换成二进制
byte[] imabytesin = br.ReadBytes((int)fs.Length);
Image img = reph(imabytesin);//将二进制数组转换成Image类型
this.imageList1.Images.Add("", img);
this.imageList1.Images.Add("", img);
this.imageList1.Images.Add("", img);//保存到imagelist中
InitializeGrid(); private void InitializeGrid()
{
GridPanel panel = superGridControl1.PrimaryGrid;
//指定显示的列
GridColumn column = panel.Columns[];
column.EditorType = typeof(MyGridImageEditControl);
column.EditorParams = new object[] { imageList1, ImageSizeMode.Zoom };
}
private class MyGridImageEditControl : GridImageEditControl
{
public MyGridImageEditControl(ImageList imageList, ImageSizeMode sizeMode)
{
ImageList = imageList;
ImageSizeMode = sizeMode;
}
}
加载combox下拉
var girdc = superGridControl1.PrimaryGrid.Columns[];
var list = new object[] { "销售部", "采购部" };
girdc.EditorType = typeof(MyComboBox);
girdc.EditorParams = new object[] { list };
实例图片

百度的搬运工,亲测
DotNetBar 中 SuperGridControl 加载数据、获取数据、设置样式的更多相关文章
- Style样式的四种使用(包括用C#代码动态加载资源文件并设置样式)
Posted on 2012-03-23 11:21 祥叔 阅读(2886) 评论(6) 编辑 收藏 在Web开发中,我们通过CSS来控制页面元素的样式,一般常用三种方式: 1. 内联样式 ...
- 在Pandas中直接加载MongoDB的数据
在使用Pandas进行数据处理的时候,我们通常从CSV或EXCEL中导入数据,但有的时候数据都存在数据库内,我们并没有现成的数据文件,这时候可以通过Pymongo这个库,从mongoDB中读取数据,然 ...
- html中的数据岛:利用DSO和javascript在html中动态加载和浏览xml数据
1.DSO也叫做数据源对象,IE 4.0引入了DSO,在IE 5.0对DSO技术进行很大的扩展.以往如果数据是通过SQL语言对数据库进行查询得到的结果,那么就把它们存放在ADO(ActiveX Dat ...
- Flink 中定时加载外部数据
社区中有好几个同学问过这样的场景: flink 任务中,source 进来的数据,需要连接数据库里面的字段,再做后面的处理 这里假设一个 ETL 的场景,输入数据包含两个字段 “type, useri ...
- Tomcat启动时加载数据到缓存---web.xml中listener加载顺序(例如顺序:1、初始化spring容器,2、初始化线程池,3、加载业务代码,将数据库中数据加载到内存中)
最近公司要做功能迁移,原来的后台使用的Netty,现在要迁移到在uap上,也就是说所有后台的代码不能通过netty写的加载顺序加载了. 问题就来了,怎样让迁移到tomcat的代码按照原来的加载顺序进行 ...
- jsTree 的简单用法--异步加载和刷新数据
首先这两个文件是必须要引用的,还有就是引用 jQuery 文件就不说了: <link href="/css/plugins/jsTree/style.min.css" rel ...
- 使用getJSON()方法异步加载JSON格式数据
使用getJSON()方法异步加载JSON格式数据 使用getJSON()方法可以通过Ajax异步请求的方式,获取服务器中的数组,并对获取的数据进行解析,显示在页面中,它的调用格式为: jQuery. ...
- redis启动加载过程、数据持久化
背景 公司一年的部分业务数据放在redis服务器上,但数据量比较大,单纯的string类型数据一年就将近32G,而且是经过压缩后的. 所以我在想能否通过获取string数据的时间改为保存list数据类 ...
- 加载的DAL数据访问层的类型
using System; using System.Collections; using System.Reflection; using CSFrameworkV4_5.Core; using C ...
随机推荐
- Python 小结
1. Python pass是空语句,是为了保持程序结构的完整性. pass 不做任何事情,一般用做占位语句. 2.删除一个list里面的重复元素 方法一:是利用map的fromkeys来自动过滤重复 ...
- 有关Zedgraph的功能扩展的笔记
1.坐标轴范围.刻度调整后需要加上下面的语句才能刷新: zedGraphControl1.AxisChange(); zedGraphControl1.Refresh(); 2.坐标范 ...
- spring boot 项目打包到maven仓库供其它模块使用
在对spring boot项目进行打包发布的时候发现其它spring boot项目服务真正引用使用该spring boot包中的类 需对打包插件做如下修改: <build> <plu ...
- 拼接sql
String whereArgs = taskTable + " where 1=1 "; if (upCheck) { whereArgs += " and type ...
- 解剖Nginx·自动脚本篇(3)源码相关变量脚本 auto/sources
在configure脚本中,运行完auto/options和auto/init脚本后,接下来就运行auto/soures脚本.这个脚本是为编译做准备的. 目录 核心模块 事件模块 OpenSSL 模块 ...
- 使用批处理命令设置windows系统的ip地址和dns
找到对应的网卡名称 使用命令:ipconfig ipconfig/all Windows IP Configuration Host Name . . . . . . . . . . . . : D5 ...
- [Groovy] Groovy API
http://www.soapui.org/about-soapui/soapui-faq.html#1-SoapUI--General-Questions 3.1.1. What is Groovy ...
- 05 Computing GC Content
Problem The GC-content of a DNA string is given by the percentage of symbols in the string that are ...
- 快捷生成getter和setter方法
选中要生成的名称 shift+alt快捷弹出选款,然后箭头下,然后Alt+A,点击ok
- schedule-pool模拟并行任务分片
模拟并行任务分片 代码部分: package com.pool; import com.alibaba.fastjson.JSON; import java.io.BufferedReader; im ...