下面的示例代码接管了 TreeList.ShowTreeListMenu 事件,以便于实现下述两个目的。
-
禁用“Department”列的汇总脚注的上下文菜单。
-
移除列标头的上下文菜单中的“Runtime columns customization”菜单项。
C# | 复制代码 |
---|
using DevExpress.XtraTreeList;
private void treeList1_ShowTreeListMenu(object sender, TreeListMenuEventArgs e) {
TreeListHitInfo hitInfo = treeList1.CalcHitInfo(e.Point);
if (hitInfo.HitInfoType == HitInfoType.SummaryFooter &&
hitInfo.Column.Caption == "Department")
e.Allow = false;
if (hitInfo.HitInfoType == HitInfoType.Column)
e.Menu.Items.RemoveAt(3);
}
|
Visual Basic | 复制代码 |
---|
Imports DevExpress.XtraTreeList
Private Sub TreeList1_ShowTreeListMenu(ByVal sender As Object, _
ByVal e As TreeListMenuEventArgs) Handles TreeList1.ShowTreeListMenu
Dim HitInfo As TreeListHitInfo = TreeList1.CalcHitInfo(e.Point)
If HitInfo.HitInfoType = HitInfoType.SummaryFooter _
And HitInfo.Column.Caption = "Department" Then
e.Allow = False
End If
If HitInfo.HitInfoType = HitInfoType.Column Then
e.Menu.Items.RemoveAt(3)
End If
End Sub
|