DevXpress 控件: 第一篇: 将 Master_Details 关系进行到底--XtraPivotGridControl控件
2008-10-21 09:38
337 查看
一. 控件说明: XtraPivotGridControl;数据控件
二. 控件特点:
1. 支持行, 列字段拖动, 对调
支持行, 列字段的添加, 移除
支持数据字段的添加, 移除, 对调
2. 支持以行, 列字段排序
支持以过滤字段排序
3. 支持行, 列字段过滤
4. 支持行, 列字段的归类, 即形成父子层
横向和竖向同时形成树结构, 可收缩展开
三.测试数据: 1.数据库: sqlserver2000; Norwind
2.关联表: Customers; Orders; Order_Details; Products;
3.DevExpress 版本: V8.1
四. 运行截图:
1. 行字段: 客户名称;订单号
列字段: 产品名称
数据字段: 商品单价;购买数量
过滤字段: 客户公司名称;所签合同名;订购日期;截止日期;提货日期
子逸制作--动态添加字段
/// <summary>
/// 给消费链添加添加字段
/// </summary>
private void AddOrdersColumns()
{
//Customers表
PivotGridField customerID = new PivotGridField();
customerID.FieldName = "CustomerID";
customerID.Caption = "客户名称";
customerID.Area = DevExpress.XtraPivotGrid.PivotArea.RowArea;
PivotGridField companyName = new PivotGridField();
companyName.FieldName = "CompanyName";
companyName.Caption = "客户公司名称";
companyName.Area = DevExpress.XtraPivotGrid.PivotArea.FilterArea;
companyName.Width = 150;
PivotGridField contactTitle = new PivotGridField();
contactTitle.FieldName = "ContactTitle";
contactTitle.Caption = "所签合同名";
contactTitle.Area = DevExpress.XtraPivotGrid.PivotArea.FilterArea;
//Orders表
PivotGridField orderID = new PivotGridField();
orderID.FieldName = "OrderID";
orderID.Caption = "订单号";
orderID.Area = DevExpress.XtraPivotGrid.PivotArea.RowArea;
PivotGridField orderDate = new PivotGridField();
orderDate.FieldName = "OrderDate";
orderDate.Caption = "订购日期";
orderDate.Area = DevExpress.XtraPivotGrid.PivotArea.FilterArea;
PivotGridField requiredDate = new PivotGridField();
requiredDate.FieldName = "RequiredDate";
requiredDate.Caption = "截止日期";
requiredDate.Area = DevExpress.XtraPivotGrid.PivotArea.FilterArea;
PivotGridField shippedDate = new PivotGridField();
shippedDate.FieldName = "ShippedDate";
shippedDate.Caption = "提货日期";
shippedDate.Area = DevExpress.XtraPivotGrid.PivotArea.FilterArea;
//OrderDetails
PivotGridField unitPrice = new PivotGridField();
unitPrice.FieldName = "UnitPrice";
unitPrice.Caption = "商品单价";
unitPrice.Area = DevExpress.XtraPivotGrid.PivotArea.DataArea;
PivotGridField Quantity = new PivotGridField();
Quantity.FieldName = "Quantity";
Quantity.Caption = "购买数量";
Quantity.Area = DevExpress.XtraPivotGrid.PivotArea.DataArea;
//Product表
PivotGridField productName = new PivotGridField();
productName.FieldName = "ProductName";
productName.Caption = "产品名称";
productName.Area = DevExpress.XtraPivotGrid.PivotArea.ColumnArea;
//添加到控制中
this.pivotGridControl1.Fields.Add(customerID);
this.pivotGridControl1.Fields.Add(companyName);
this.pivotGridControl1.Fields.Add(contactTitle);
this.pivotGridControl1.Fields.Add(orderID);
this.pivotGridControl1.Fields.Add(orderDate);
this.pivotGridControl1.Fields.Add(requiredDate);
this.pivotGridControl1.Fields.Add(shippedDate);
this.pivotGridControl1.Fields.Add(unitPrice);
this.pivotGridControl1.Fields.Add(Quantity);
this.pivotGridControl1.Fields.Add(productName);
}
2. 运行时改变字段的显示区域
customerID.Area = DevExpress.XtraPivotGrid.PivotArea.RowArea;
五. 属性
1. 允许拖动
this.pivotGridControl1.OptionsCustomization.AllowDrag = true;
2. 允许排序
this.pivotGridControl1.OptionsCustomization.AllowSort = true;
3. 允许过滤
this.pivotGridControl1.OptionsCustomization.AllowFilter = true;
六: 总结后记
1. 此控件较为灵活;对于 Master_Details 关系表处理的相当好;
2. 此控件数据区只能显示数字类型字段, 类似于统计分析;
3. 后面会有更多的 DevExpress 控件介绍给大家
4. 这里只介绍控件的简单使用;如需更复杂的技术支持或交流请与作者联系;
QQ: 915571300 子逸
5. 版权所有: 子逸(博客园);转载请注明出处;
二. 控件特点:
1. 支持行, 列字段拖动, 对调
支持行, 列字段的添加, 移除
支持数据字段的添加, 移除, 对调
2. 支持以行, 列字段排序
支持以过滤字段排序
3. 支持行, 列字段过滤
4. 支持行, 列字段的归类, 即形成父子层
横向和竖向同时形成树结构, 可收缩展开
三.测试数据: 1.数据库: sqlserver2000; Norwind
2.关联表: Customers; Orders; Order_Details; Products;
3.DevExpress 版本: V8.1
四. 运行截图:
1. 行字段: 客户名称;订单号
列字段: 产品名称
数据字段: 商品单价;购买数量
过滤字段: 客户公司名称;所签合同名;订购日期;截止日期;提货日期
子逸制作--动态添加字段
/// <summary>
/// 给消费链添加添加字段
/// </summary>
private void AddOrdersColumns()
{
//Customers表
PivotGridField customerID = new PivotGridField();
customerID.FieldName = "CustomerID";
customerID.Caption = "客户名称";
customerID.Area = DevExpress.XtraPivotGrid.PivotArea.RowArea;
PivotGridField companyName = new PivotGridField();
companyName.FieldName = "CompanyName";
companyName.Caption = "客户公司名称";
companyName.Area = DevExpress.XtraPivotGrid.PivotArea.FilterArea;
companyName.Width = 150;
PivotGridField contactTitle = new PivotGridField();
contactTitle.FieldName = "ContactTitle";
contactTitle.Caption = "所签合同名";
contactTitle.Area = DevExpress.XtraPivotGrid.PivotArea.FilterArea;
//Orders表
PivotGridField orderID = new PivotGridField();
orderID.FieldName = "OrderID";
orderID.Caption = "订单号";
orderID.Area = DevExpress.XtraPivotGrid.PivotArea.RowArea;
PivotGridField orderDate = new PivotGridField();
orderDate.FieldName = "OrderDate";
orderDate.Caption = "订购日期";
orderDate.Area = DevExpress.XtraPivotGrid.PivotArea.FilterArea;
PivotGridField requiredDate = new PivotGridField();
requiredDate.FieldName = "RequiredDate";
requiredDate.Caption = "截止日期";
requiredDate.Area = DevExpress.XtraPivotGrid.PivotArea.FilterArea;
PivotGridField shippedDate = new PivotGridField();
shippedDate.FieldName = "ShippedDate";
shippedDate.Caption = "提货日期";
shippedDate.Area = DevExpress.XtraPivotGrid.PivotArea.FilterArea;
//OrderDetails
PivotGridField unitPrice = new PivotGridField();
unitPrice.FieldName = "UnitPrice";
unitPrice.Caption = "商品单价";
unitPrice.Area = DevExpress.XtraPivotGrid.PivotArea.DataArea;
PivotGridField Quantity = new PivotGridField();
Quantity.FieldName = "Quantity";
Quantity.Caption = "购买数量";
Quantity.Area = DevExpress.XtraPivotGrid.PivotArea.DataArea;
//Product表
PivotGridField productName = new PivotGridField();
productName.FieldName = "ProductName";
productName.Caption = "产品名称";
productName.Area = DevExpress.XtraPivotGrid.PivotArea.ColumnArea;
//添加到控制中
this.pivotGridControl1.Fields.Add(customerID);
this.pivotGridControl1.Fields.Add(companyName);
this.pivotGridControl1.Fields.Add(contactTitle);
this.pivotGridControl1.Fields.Add(orderID);
this.pivotGridControl1.Fields.Add(orderDate);
this.pivotGridControl1.Fields.Add(requiredDate);
this.pivotGridControl1.Fields.Add(shippedDate);
this.pivotGridControl1.Fields.Add(unitPrice);
this.pivotGridControl1.Fields.Add(Quantity);
this.pivotGridControl1.Fields.Add(productName);
}
2. 运行时改变字段的显示区域
customerID.Area = DevExpress.XtraPivotGrid.PivotArea.RowArea;
五. 属性
1. 允许拖动
this.pivotGridControl1.OptionsCustomization.AllowDrag = true;
2. 允许排序
this.pivotGridControl1.OptionsCustomization.AllowSort = true;
3. 允许过滤
this.pivotGridControl1.OptionsCustomization.AllowFilter = true;
六: 总结后记
1. 此控件较为灵活;对于 Master_Details 关系表处理的相当好;
2. 此控件数据区只能显示数字类型字段, 类似于统计分析;
3. 后面会有更多的 DevExpress 控件介绍给大家
4. 这里只介绍控件的简单使用;如需更复杂的技术支持或交流请与作者联系;
QQ: 915571300 子逸
5. 版权所有: 子逸(博客园);转载请注明出处;
相关文章推荐
- DevXpress控件: 第三篇: 将 父子 关系进行到底--TreeList 控件
- DevXpress控件: 第二篇--将绘图进行到底: Charter控件(附图)
- DevXpress控件: 第二篇--将绘图进行到底: Charter控件(附图)
- DevXpress控件: 第二篇--将绘图进行到底: Charter控件(附图)
- DevXpress控件: 第二篇--将绘图进行到底: Charter控件(附图)
- 第一篇:初识ASP.NET控件开发_第一节:控件类及其继承关系
- FormView控件和DetailsGridView控件实现Master-Slave
- Mater-Details数据查询修改时,在用DetailsView进行新建,编辑(添加DropDownList控件)应用时需要注意的几点问题
- Masonry 当需要把某个控件进行隐藏的时候有警告的解决方案
- C# 使用FileUpload控件上传图片,将文件转换成二进制进行存储与读取
- Dev系列控件之XtraChart高级应用(模拟flash鼠标移动,点击实现相关信息提示)
- 成都传智播客公开课,将activiti进行到底
- 调用Gmaps根据地址显示对应的Google地图(对控件进行隐藏和改变)
- 深入理解闭包系列第一篇——到底什么才是闭包
- cocos2dx 3.3 cocos studio控件与C++代码内类的对应关系
- EasySize使用笔记(对话框中的控件随着对话框大小的变化进行自动调整)
- 勒紧腰带,将穷日子进行到底
- 【flex4.6将移动开发进行到底】第一章第二节hello,flex4.6!
- \t\t每日卡巴斯基安全部队2011激活码及激活KEY,将免费进行到底
- 最近在做多媒体播放器时发现VC里没有ActiveMovieControl Object这个控件,可进行如下操作: