我以自定义形式显示字段。我选择Excel2007
为CustomizationFormStyle
,但我想展示Filter
区域。我希望Column
,Row
和Data
区域不可见
我该如何管理?
pivotGridControl1.OptionsCustomization.CustomizationFormStyle = DevExpress.XtraPivotGrid.Customization.CustomizationFormStyle.Excel2007;
pivotGridControl1.OptionsCustomization.CustomizationFormLayout = CustomizationFormLayout.BottomPanelOnly1by4;
pivotGridControl1.OptionsCustomization.CustomizationFormAllowedLayouts = CustomizationFormAllowedLayouts.BottomPanelOnly1by4;
答案 0 :(得分:0)
您需要使用PivotGridControl.ShowingCustomizationForm
事件和PivotGridControl.ShowCustomizationForm
事件。在PivotGridControl.ShowingCustomizationForm
事件中,您需要从CustomizationFormShowingEventArgs.CustomizationForm
属性获取CustomizationForm
对象,并在PivotGridControl.ShowCustomizationForm
事件中使用此对象来自定义自定义表单。要获取过滤器区域和其他区域对象,您需要使用CustomizationForm.BottomPanel
属性及其GetAreaLabel
,GetAreaIcon
和GetAreaList
方法。
这是一个例子:
private void pivotGridControl1_ShowingCustomizationForm(object sender, CustomizationFormShowingEventArgs e)
{
_customizationForm = e.CustomizationForm as CustomizationForm;
}
private void pivotGridControl1_ShowCustomizationForm(object sender, EventArgs e)
{
var bottomPanel = _customizationForm.BottomPanel as ExcelCustomizationFormBottomPanel;
var areas = new PivotArea[] { PivotArea.ColumnArea, PivotArea.RowArea, PivotArea.DataArea };
foreach (var area in areas)
{
bottomPanel.GetAreaLabel(area).Hide();
bottomPanel.GetAreaIcon(area).Hide();
bottomPanel.GetAreaList(area).Hide();
}
var filterAreaList = bottomPanel.GetAreaList(PivotArea.FilterArea);
var dataAreaList = bottomPanel.GetAreaList(PivotArea.DataArea);
filterAreaList.Height = dataAreaList.Bottom - filterAreaList.Top;
}