c# - Now overload for method 'Show'takes 2 argument -
i'm working on code-editor , make mouseevent rightclick code:
if (e.button == mousebuttons.right) { lbright.show(cursor.position.x, cursor.position.y); lbright.bringtofront(); }
but problem everytime runs 'overload method' error appears , pointing .show(cursor.position.x, cursor.position.y);
how can avoid it? well-appreciated thanks!
if use contextmenu , use overload of .show(control, point) offset should menu showing:
if (e.button == mousebuttons.right) { // build new contextmenu menu items, let's use copy , paste contextmenu ctxrightclick = new contextmenu(new menuitem[] { new menuitem("copy"), new menuitem("paste") }); // per documentation, point used .show relative control pass in calculate offset mouse position int xoffset = cursor.position.x - myform.location.x; int yoffset = cursor.position.y - myform.location.y; // show context menu child of myform @ specified offset ctxrightclick.show(myform, new point(xoffset, yoffset)); }
Comments
Post a Comment