private void contextMenuStrip_Opening(object sender, CancelEventArgs eventArgs) { eventArgs.Cancel = true; ListViewHitTestInfo listViewHitTestInfo = this.ListViewScan.HitTest(this.ListViewScan.PointToClient(Cursor.Position)); if (listViewHitTestInfo == null) { return; } if (listViewHitTestInfo.Item == null) { return; } if (this.ListViewScan.SelectedItems.Contains(listViewHitTestInfo.Item) == false) { return; } if (listViewHitTestInfo.Location != ListViewHitTestLocations.Label) { return; } CommandBar popupCommandBar = MainForm.Instance.axCommandBars.Add("ConfigAControl", XTPBarPosition.xtpBarPopup); CommandBarControl commandBarControl = popupCommandBar.Controls.Add(XTPControlType.xtpControlButton, ResourceId.ID_CONFIG_FORM2_DELETE, "删除(&D)", -1, false); popupCommandBar.ShowPopup(XTPTrackPopupFlags.TPM_RIGHTBUTTON, null, null); }
private void contextMenuStripSGLFrame_Opening(object sender, CancelEventArgs e) { e.Cancel = true; if (ListViewSGLImage.SelectedIndices.Count != 1) { return; } if (ListViewSGLFrame.SelectedIndices.Count > 1) { return; } if (ListViewSGLFrame.SelectedIndices.Count < 1) { CommandBar popupCommandBar = m_SGLEditorForm.axCommandBars.Add("SGLFramePopup", XTPBarPosition.xtpBarPopup); CommandBarControl commandBarControl = popupCommandBar.Controls.Add(XTPControlType.xtpControlButton, ResourceID.ID_INSERT, "插入(&I)", -1, false); commandBarControl.Enabled = PageOpenImageControl.IsOpenImage; commandBarControl = popupCommandBar.Controls.Add(XTPControlType.xtpControlButton, ResourceID.ID_INSERT_MULTI, "插入多文件(&R)", -1, false); commandBarControl.Enabled = true; popupCommandBar.ShowPopup(XTPTrackPopupFlags.TPM_RIGHTBUTTON, null, null); return; } ListViewHitTestInfo listViewHitTestInfo = ListViewSGLFrame.HitTest(ListViewSGLFrame.PointToClient(Cursor.Position)); if (listViewHitTestInfo == null) { return; } if (listViewHitTestInfo.Item == null) { return; } CommandBar popupCommandBar2 = m_SGLEditorForm.axCommandBars.Add("SGLFramePopup2", XTPBarPosition.xtpBarPopup); CommandBarControl commandBarControl2 = popupCommandBar2.Controls.Add(XTPControlType.xtpControlButton, ResourceID.ID_INSERT, "插入(&I)", -1, false); commandBarControl2.Enabled = PageOpenImageControl.IsOpenImage; commandBarControl2 = popupCommandBar2.Controls.Add(XTPControlType.xtpControlButton, ResourceID.ID_INSERT_MULTI, "插入多文件(&R)", -1, false); commandBarControl2.Enabled = true; commandBarControl2 = popupCommandBar2.Controls.Add(XTPControlType.xtpControlButton, ResourceID.ID_REPLACE, "替换(&R)", -1, false); commandBarControl2.Enabled = PageOpenImageControl.IsOpenImage; commandBarControl2 = popupCommandBar2.Controls.Add(XTPControlType.xtpControlButton, ResourceID.ID_DELETE, "删除(&R)", -1, false); commandBarControl2.Enabled = true; popupCommandBar2.ShowPopup(XTPTrackPopupFlags.TPM_RIGHTBUTTON, null, null); }
private void contextMenuStrip_Opening(object sender, CancelEventArgs eventArgs) { eventArgs.Cancel = true; m_CurrentDelTreeNode = null; TreeViewHitTestInfo treeViewHitTestInfo = this.TreeView.HitTest(this.TreeView.PointToClient(Cursor.Position)); if (treeViewHitTestInfo == null) { return; } if (treeViewHitTestInfo.Location != TreeViewHitTestLocations.Label) { return; } TreeNode hitTreeNode = treeViewHitTestInfo.Node; if (hitTreeNode == null) { return; } if (hitTreeNode.Parent != null) { return; } if (hitTreeNode == m_MainTreeNode) { return; } m_CurrentDelTreeNode = hitTreeNode; CommandBar popupCommandBar = MainForm.Instance.AxCommandBars.Add("StartTaskFormPopup", XTPBarPosition.xtpBarPopup); popupCommandBar.Controls.Add(XTPControlType.xtpControlCheckBox, ResourceId.ID_TASK_FORM_DELETE, "删除(&D)", -1, false); popupCommandBar.ShowPopup(XTPTrackPopupFlags.TPM_RIGHTBUTTON, null, null); }
private void contextMenuStrip1_Opening(object sender, CancelEventArgs e) { e.Cancel = true; if (ListViewSGLImage.SelectedIndices.Count != 1) { return; } ListViewHitTestInfo listViewHitTestInfo = ListViewSGLImage.HitTest(ListViewSGLImage.PointToClient(Cursor.Position)); if (listViewHitTestInfo == null) { return; } if (listViewHitTestInfo.Item == null) { return; } CommandBar popupCommandBar2 = m_SGLEditorForm.axCommandBars.Add("SGLImagePopup1", XTPBarPosition.xtpBarPopup); CommandBarControl commandBarControl2 = popupCommandBar2.Controls.Add(XTPControlType.xtpControlCheckBox, ResourceID.ID_SGL_ADD_PATH, "加入补丁列表(&A)", -1, false); commandBarControl2 = popupCommandBar2.Controls.Add(XTPControlType.xtpControlButton, ResourceID.ID_INSERT_MULTI_IMAGE, "插入多帧的文件(&I)", -1, false); commandBarControl2.Enabled = true; bool bIsFind = false; foreach (KeyValuePair <int, CommandBarControl> intItem in m_AddPathList) { if (intItem.Key == listViewHitTestInfo.Item.Index) { bIsFind = true; break; } } commandBarControl2.Checked = bIsFind; popupCommandBar2.ShowPopup(XTPTrackPopupFlags.TPM_RIGHTBUTTON, null, null); }
private void ContextMenuStripDelete_Opening(object sender, CancelEventArgs eventArgs) { eventArgs.Cancel = true; TreeViewHitTestInfo treeViewHitTestInfo = this.TreeView.HitTest(this.TreeView.PointToClient(Cursor.Position)); if (treeViewHitTestInfo == null) { m_CurrentDeleteTreeNode = null; return; } if (treeViewHitTestInfo.Location != TreeViewHitTestLocations.Label) { m_CurrentDeleteTreeNode = null; return; } if (treeViewHitTestInfo.Node == null) { m_CurrentDeleteTreeNode = null; return; } if (treeViewHitTestInfo.Node.Parent != null && treeViewHitTestInfo.Node.Text == "所有的股票") { m_CurrentDeleteTreeNode = null; return; } m_CurrentDeleteTreeNode = treeViewHitTestInfo.Node; CommandBar popupCommandBar = MainForm.Instance.AxCommandBars.Add("ConfigAControl", XTPBarPosition.xtpBarPopup); CommandBarControl commandBarControl = popupCommandBar.Controls.Add(XTPControlType.xtpControlButton, ResourceId.ID_CONFIG_FORM_TREEVIEW_DELETE, "删除(&D)", -1, false); popupCommandBar.ShowPopup(XTPTrackPopupFlags.TPM_RIGHTBUTTON, null, null); }
public void ShowPopup(object x, object y) { _bar.ShowPopup(x, y); }