internal void ShowMenu(GridMenuType type, GridColumn column) { Rectangle columnBounds = Rectangle.Empty; if (type == GridMenuType.Column) { columnBounds = ViewInfo.ColumnsInfo[column].CaptionRect; } if (type == GridMenuType.Group) { if (column == null) { columnBounds = ViewInfo.GroupPanel.Rows[0].Bounds; } else { columnBounds = ViewInfo.GroupPanel.Rows[0].ColumnsInfo[column].CaptionRect; } } if (type == GridMenuType.Summary) { columnBounds = ViewInfo.FooterInfo.Cells[column.VisibleIndex].Bounds; } if (!columnBounds.IsEmpty) { DestroyCustomization(); var args = new DevExpress.Utils.DXMouseEventArgs(System.Windows.Forms.MouseButtons.Right, 1, columnBounds.Left + columnBounds.Width / 2, columnBounds.Top + columnBounds.Height / 2, 0); Handler.ProcessEvent(DevExpress.Utils.Controls.EventType.MouseDown, args); // HighlightPaint.InvalidateControls(GridControl); } }
internal void ShowMenu(TreeListMenuType type, TreeListColumn column) { Rectangle columnBounds = Rectangle.Empty; if (type == TreeListMenuType.Column) { columnBounds = ViewInfo.ColumnsInfo[column].CaptionRect; } if (type == TreeListMenuType.Summary) { columnBounds = ViewInfo.SummaryFooterInfo[column].ItemBounds; } if (!columnBounds.IsEmpty) { DestroyCustomization(); var args = new DevExpress.Utils.DXMouseEventArgs(System.Windows.Forms.MouseButtons.Right, 1, columnBounds.Left + columnBounds.Width / 2, columnBounds.Top + columnBounds.Height / 2, 0); Handler.OnMouseDown(args); // HighlightPaint.InvalidateControls(this); } }
void IPreview.Show(Enum value) { if (value is TreeListStringId) { var name = Enum.GetName(typeof(TreeListStringId), value); var id = (TreeListStringId)value; // Menus if (name.StartsWith("MenuFooter")) { ((TreeListPreview)treeList1).ShowMenu(TreeListMenuType.Summary, treeList1.Columns["Age"]); return; } if (name.StartsWith("MenuColumn")) { ((TreeListPreview)treeList1).ShowMenu(TreeListMenuType.Column, treeList1.Columns["Age"]); return; } // Customization if (name.Contains("Customization")) { treeList1.ColumnsCustomization(); } else { treeList1.DestroyCustomization(); } // Filters if (name.StartsWith("PopupFilter")) { ((TreeListPreview)treeList1).ShowFilterPopup(treeList1.Columns["SID"], DevExpress.XtraTreeList.FilterPopupMode.CheckedList); } if (name.StartsWith("FilterEditor")) { treeList1.ShowFilterEditor(treeList1.Columns["Age"]); } HighlightPaint.InvalidateControls(treeList1); } }
void IPreview.Show(Enum value) { if (value is GridStringId) { var name = Enum.GetName(typeof(GridStringId), value); var id = (GridStringId)value; // Menus if (name.StartsWith("MenuFooter")) { ((GridViewPreview)gridView1).ShowMenu(GridMenuType.Summary, gridView1.Columns["Age"]); return; } if (name.StartsWith("MenuColumn")) { if (name.StartsWith("MenuColumnGroup")) { ((GridViewPreview)gridView1).ShowMenu(GridMenuType.Group, gridView1.Columns["Open"]); } else { ((GridViewPreview)gridView1).ShowMenu(GridMenuType.Column, gridView1.Columns["Age"]); } return; } if (name.StartsWith("MenuGroupPanel")) { if (id <= GridStringId.MenuGroupPanelHide) { ((GridViewPreview)gridView1).ShowMenu(GridMenuType.Group, null); } else { ((GridViewPreview)gridView1).ShowMenu(GridMenuType.Group, gridView1.Columns["IsActive"]); } return; } // Customization if (name.Contains("Customization")) { gridView1.ShowCustomization(); } else { gridView1.HideCustomization(); } // Filters if (name.StartsWith("PopupFilter")) { ((GridViewPreview)gridView1).ShowFilterPopup(gridView1.Columns["SID"], FilterPopupMode.CheckedList); } if (name.StartsWith("FilterEditor")) { gridView1.ShowFilterEditor(gridView1.Columns["Age"]); } if (name.StartsWith("CustomFilterDialog")) { gridView1.ShowCustomFilterDialog(gridView1.Columns["Age"]); } HighlightPaint.InvalidateControls(gridControl1); } }