winforms - C# - Contextmenu bug with SaveFileDialog -
i use contextmenu on pictureedit (devexpress) when user right clicks , select menu item should save file. context menu still showing when savedialog windows open.
how remove bug?
private void initializecontextmenu() { ui_pictureedit.properties.contextmenustrip = new contextmenustrip(); var menu = new contextmenustrip(); menu.items.add("save image"); menu.itemclicked += contextmenu_saveimageclicked; menu.show(); ui_pictureedit.properties.contextmenustrip = menu; } using (var dialog = new savefiledialog()) { dialog.defaultext = "*.png"; dialog.filter = "image files (*.png)|*.png|all files (*.*)|*.*"; if (dialog.showdialog() == dialogresult.ok) { ui_pictureedit.image.save(dialog.filename); } }
so can close question:
move menu
object scope it's accessible contextmenu_saveimageclicked handler, include line in handler:
menu.hide();
to elaborate bit, context menu top-level window appear on other window isn't top-level, including file dialog. , clicking item doesn't automatically hide context menu, @ least not before event handler executed, why need manually before popping dialog.
Comments
Post a Comment