彩票走势图

XtraPivotGrid如何把In-place Editors分配到特定的单元格

原创|其它|编辑:郝浩|2012-11-07 17:09:01.000|阅读 722 次

概述:本文运用PivotGridControl.CustomCellEdit事件,分配不同的In-place Editors 给不同类型的单元格。

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

本文运用PivotGridControl.CustomCellEdit事件,分配不同的In-place Editors 给不同类型的单元格。

在该示例中,两个In-place Editors 被创建来代表“Qty %”字段的值。其中, ProgressBar编辑器是用来表示常规的单元格的值,而SpinEdit编辑器用来表示此字段的总额:

XtraPivotGrid如何把In-place Editors分配到特定的单元格

代码如下:

C#

using DevExpress.XtraEditors.Repository;
using DevExpress.XtraPivotGrid;

// In-place editors used to represent values of regular and total cells respectively.
RepositoryItemProgressBar editorForCells;
RepositoryItemSpinEdit editorForTotals;

// Initialize the editors.
editorForCells = new RepositoryItemProgressBar();
editorForCells.Minimum = 0;           
editorForCells.Maximum = 100;
editorForTotals = new RepositoryItemSpinEdit();
pivotGridControl1.RepositoryItems.AddRange(
  new RepositoryItem[] { editorForCells, editorForTotals });

// Provide editors for cells depending on cell types
private void pivotGridControl1_CustomCellEdit(object sender, PivotCustomCellEditEventArgs e) {
    if (e.DataField != fieldQuantityPercent) return;
    if (e.RowValueType == PivotGridValueType.GrandTotal)
        e.RepositoryItem = editorForTotals;
    if (e.RowValueType == PivotGridValueType.Value)
        e.RepositoryItem = editorForCells;
}


VB

Imports DevExpress.XtraEditors.Repository
Imports DevExpress.XtraPivotGrid

' In-place editors used to represent values of regular and total cells respectively.
Dim editorForCells As RepositoryItemProgressBar
Dim editorForTotals As RepositoryItemSpinEdit

' Initialize the editors.
editorForCells = New RepositoryItemProgressBar()
editorForCells.Minimum = 0
editorForCells.Maximum = 100
editorForTotals = New RepositoryItemSpinEdit()
PivotGridControl1.RepositoryItems.AddRange(New RepositoryItem() _
    {editorForCells, editorForTotals})

' Provide editors for cells depending on cell types
Private Sub PivotGridControl1_CustomCellEdit(ByVal sender As System.Object, _
ByVal e As PivotCustomCellEditEventArgs) Handles PivotGridControl1.CustomCellEdit
    If e.DataField <> fieldQuantityPercent Then Return
    If e.RowValueType = PivotGridValueType.GrandTotal Then e.RepositoryItem = editorForTotals
    If e.RowValueType = PivotGridValueType.Value Then e.RepositoryItem = editorForCells
End Sub

 

 


标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@cahobeh.cn

文章转载自:慧都控件网

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP