コード例 #1
0
 /// <summary>
 ///     鼠标动作(非顶层)
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void trvData_MouseClick_NotTop(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         contextMenuStripMain = new ContextMenuStrip();
         contextMenuStripMain.Items.Add(AddElementToolStripMenuItem.Clone());
         contextMenuStripMain.Items.Add(ModifyElementToolStripMenuItem.Clone());
         contextMenuStripMain.Items.Add(DropElementToolStripMenuItem.Clone());
         contextMenuStripMain.Items.Add(CopyElementToolStripMenuItem.Clone());
         contextMenuStripMain.Items.Add(CutElementToolStripMenuItem.Clone());
         contextMenuStripMain.Items.Add(PasteElementToolStripMenuItem.Clone());
         trvData.DatatreeView.ContextMenuStrip = contextMenuStripMain;
         contextMenuStripMain.Show(trvData.DatatreeView.PointToScreen(e.Location));
     }
 }
コード例 #2
0
ファイル: ctlDocumentView.cs プロジェクト: huaryliu/MongoCola
 /// <summary>
 ///     鼠标动作(非顶层)
 /// </summary>
 /// <param name="e"></param>
 private void trvData_MouseClick_NotTop(MouseEventArgs e)
 {
     if (MDataViewInfo.IsView)
     {
         return;                       //View是只读的
     }
     if (e.Button != MouseButtons.Right)
     {
         return;
     }
     contextMenuStripMain = new ContextMenuStrip();
     contextMenuStripMain.Items.Add(AddElementToolStripMenuItem.Clone());
     contextMenuStripMain.Items.Add(ModifyElementToolStripMenuItem.Clone());
     contextMenuStripMain.Items.Add(DropElementToolStripMenuItem.Clone());
     contextMenuStripMain.Items.Add(CopyElementToolStripMenuItem.Clone());
     contextMenuStripMain.Items.Add(CutElementToolStripMenuItem.Clone());
     contextMenuStripMain.Items.Add(PasteElementToolStripMenuItem.Clone());
     trvData.DatatreeView.ContextMenuStrip = contextMenuStripMain;
     contextMenuStripMain.Show(trvData.DatatreeView.PointToScreen(e.Location));
 }