我使用Xtragrid。我想更改默认的popupmenu columnmenu GridViewColumnMenu并添加ColorPieker和FontEditor来更改列的列和字体中单元格的颜色。添加到标准菜单列的两个编辑器都失败了。更确切地说,添加了菜单项,但通过点击它们,没有任何反应。 我还尝试将所有标准菜单项添加到编辑器的菜单中,并在barmanager中显示所有菜单项。在这种情况下,作为颜色和字体选择的编辑器,但标准菜单(GridViewColumnMenu)项目不起作用
if (e.MenuType == DevExpress.XtraGrid.Views.Grid.GridMenuType.Column)
{
DevExpress.XtraGrid.Menu.GridViewColumnMenu menu = e.Menu as GridViewColumnMenu;
// menu.Items.Clear();//Erasing the default menu items
if (menu.Column != null)
{
ClickedColumn = "";
ClickedColumn = menu.Column.FieldName;
DXPopupMenu dxPopupMenu = new DXPopupMenu();
dxPopupMenu.Items.Add(new DXEditMenuItem("Color",
new RepositoryItemColorEdit(),
new EventHandler(OnColumnsColorChanged),
null, null, 100, 0));
dxPopupMenu.Items.Add(new DXEditMenuItem("Font",
new RepositoryItemFontEdit(),
new EventHandler(OnColumnsFontChanged),
null, null, 100, 0));
DXPopupMenu sub = new DXPopupMenu();
sub.Caption = "FixedStyle";
sub.Items.Add(CreateCheckItem("Fixed None", menu.Column, FixedStyle.None, null));
sub.Items.Add(CreateCheckItem("Fixed Left", menu.Column, FixedStyle.Left, null));
sub.Items.Add(CreateCheckItem("Fixed Right", menu.Column, FixedStyle.Right, null));
dxPopupMenu.Items.Add(sub);
/*
DXPopupMenu dx = new DXPopupMenu();
dx.Caption = "dx";
foreach (DXMenuItem item in menu.Items)
{
dx.Items.Add(item);
}
//dxPopupMenu.Items.Add(dx);
*/
menu.Items.Clear();
Point p = e.Point;
// p.X += 210;
dxPopupMenu.MenuViewType = MenuViewType.Menu;
((IDXDropDownControl)dxPopupMenu).Show(barManager1, this, p);
尝试同时显示和菜单和菜单编辑barmanager,一切正常。但有时候菜单相互重叠并不容易。
答案 0 :(得分:0)
我有点迟了,但如果你还需要帮助,这就是你要做的事情: