private void MainControl_MouseUp(object sender, MouseEventArgs e) { if (MouseButtons.Right == (e.Button & MouseButtons.Right)) { if (null == NodeMenu) { NodeMenu = new ContextMenuStrip(); ToolStripMenuItem objOpen = new ToolStripMenuItem("Open", null, FavorateMenuOpenClick, "Open"); ToolStripSeparator objLine = new ToolStripSeparator(); ToolStripMenuItem objDel = new ToolStripMenuItem("Delete", null, FavorateMenuDeleteClick, "Delete"); NodeMenu.Items.AddRange(new ToolStripItem[] { objOpen, objLine, objDel }); } TreeNode objNode = (sender as CmTreeView).GetNodeAt(e.Location); if (null != objNode) { objArgs = new FavorateMenuArgs { Tree = sender as CmTreeView, Node = objNode }; objNode.ContextMenuStrip = NodeMenu; objNode.ContextMenuStrip.Closed += new ToolStripDropDownClosedEventHandler(ContextMenuStrip_Closed); toolFormTimer.Stop(); objNode.ContextMenuStrip.Show(sender as Control, e.Location); } } }
private void FavorateMenuDeleteClick(object sender, EventArgs e) { if (null != objArgs) { //favoriteInfo.DeleteFavorate(objArgs.Tree[objArgs.Node]["businessid"].ToString(), objArgs.Tree[objArgs.Node]["businessname"].ToString()); objArgs = null; toolFormTimer.Start(); } }
private void FavorateMenuOpenClick(object sender, EventArgs e) { if (null != objArgs) { this.OpenNewForm(objArgs.Tree, objArgs.Node); objArgs = null; toolFormTimer.Start(); } }