c# - Contextmenu showmodal -
as see contextmenu has show()
. not showmodal()
.
what need sure user clicked on item in menu. user must click on of it.
i can on closing event cancel property. when set cancel true - winforms allows select treeview's node (contextmenu tree node).
so how make context menu modal ?
for have write this
void contextmenutreeview_closed(object sender, toolstripdropdownclosedeventargs e) { if (e.closereason == toolstripdropdownclosereason.itemclicked) return; if (treeview.selectednode != null && treeview.selectednode.tag != null) { if (changecustomereventhandler != null) changecustomereventhandler(this, new customertreenodeeventargs((guid)treeview.selectednode.tag)); } else { if (newcustomereventhandler != null) newcustomereventhandler(this, eventargs.empty); } }
you cannot show standard menus in modal way hope do. that's not how menus work.
if want modal selection show modal dialog. place possible options in, instance, radio group, , allow modal dialog close when user has made selection satisfies you.
Comments
Post a Comment