UltraWinGrid:单元格添加可嵌入编辑器
来源:互联网 发布:adobe cloud mac 下载 编辑:程序博客网 时间:2024/06/11 22:04
本文转自;http://www.2cto.com/kf/201701/589747.html
嵌入式编辑器(Embeddable Editors )不仅可以作用到某一列,还可以做到单元格这一级。如下图所示:
实现代码如下:
1
2
3
4
5
6
7
8
9
10
11
12
DataTable t =
new
DataTable();
t.Columns.Add(
"Col_1"
,
typeof
(object));
t.Rows.Add(
new
object[] { Color.Red });
t.Rows.Add(
new
object[] {
false
});
t.Rows.Add(
new
object[] {
"Hello"
});
t.Rows.Add(
new
object[] { Color.Blue });
t.Rows.Add(
new
object[] {
true
});
t.Rows.Add(
new
object[] {
"Goodbye"
});
this
.ultraGrid1.DataSource = t;
初始化UltraGrid的行:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
private
void
ultraGrid1_InitializeRow(
object
sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
{
//Create the Settings Object:
DefaultEditorOwnerSettings theSettings =
new
DefaultEditorOwnerSettings();
//as well as the Editor Owner:
DefaultEditorOwner theOwner =
new
DefaultEditorOwner(theSettings);
EmbeddableEditorBase theEditor =
null
;
object
theValue = e.Row.Cells[0].Value;
//Create an appropriate editor based on the
//Value's Data Type:
if
(theValue
is
bool
)
{
theSettings.DataType =
typeof
(
bool
);
theEditor =
new
CheckEditor(theOwner);
}
else
if
(theValue
is
Color)
{
theSettings.DataType =
typeof
(Color);
theEditor =
new
ColorPickerEditor(theOwner);
}
else
if
(theValue
is
string
)
{
theSettings.DataType =
typeof
(
string
);
theEditor =
new
EditorWithText(theOwner);
}
//Assign it to the Cell.Editor
e.Row.Cells[0].Editor = theEditor;
}
也可以嵌入进度条对象,如图所示:
实现代码:
1
2
3
4
5
6
7
8
9
10
11
12
private
void
ultraGrid1_InitializeLayout(
object
sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
{
UltraProgressBar ultraProgressBar1 =
new
UltraProgressBar();
ultraProgressBar1.Minimum = 0;
ultraProgressBar1.Maximum = 100;
e.Layout.Bands[0].Columns[1].EditorComponent = ultraProgressBar1;
e.Layout.Bands[0].Columns[1].Width = 200;
}
绑定数据源
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
DataTable t =
new
DataTable();
t.Columns.AddRange(
new
DataColumn[]
{
new
DataColumn(
"工单"
,
typeof
(string)),
new
DataColumn(
"进度"
,
typeof
(object))
});
var
row = t.NewRow();
row[0] =
"workorder001"
;
row[1] = 80;
t.Rows.Add(row);
var
row2 = t.NewRow();
row2[0] =
"workorder002"
;
row2[1] = 30;
t.Rows.Add(row2);
this
.ultraGrid1.DataSource = t;
此控件英文资料查询网站http://stackoverflow.com/search?q=UltraWinGrid
0 0
- UltraWinGrid:单元格添加可嵌入编辑器
- Infragistics.Win.UltraWinGrid 单元格合并及更新
- UltraWinGrid:处理单元格输入非法值
- C# DataGridView添加可分组的单元格
- easyUI可编辑表格编辑器添加事件
- UltraWinGrid单元格绑定Tree,双击Tree结点,返回结点值到单元格
- 注册可重用单元格
- 可编辑单元格ALV
- easyui 可编辑单元格
- MongoDB:为MongoDB shell 添加可修改编辑器
- 如何实现行式报表新添加行单元格始终可写
- VC中Microsoft FlexGrid控件的使用及合并单元格、可编辑操作(EDIT控件添加)
- 润乾报表如何实现行式报表新添加行单元格始终可写
- 百度编辑器使用 嵌入ci (可灵活运用,建立数据库,写入并读出,实现用户自定义网页页面内容)
- Farpoint Spread 单元格中嵌入下拉多选框
- jtable 单元格 添加 提示
- 动态添加删除单元格
- JTable单元格添加按钮
- 98. Validate Binary Search Tree
- 君正超低功耗电池wifi可视门铃方案
- linux下利用crontab创建定时任务
- Easy 16 Sqrt(x)(69)
- 运用@Transactional,自己抛出异常时不会回滚的原因
- UltraWinGrid:单元格添加可嵌入编辑器
- uuid的自动生成
- HashMap与ConcurrentHashMap的区别
- jmeter参数化数据之自定义变量
- 创建并发布一个JSP网站
- 使用centos系统搭建openvpn服务器
- android为什么要打包(签名)?及 apk 打包(签名)流程
- 西门子培训1——RFID
- git 指令(git command [option] [reference])