예제 #1
0
파일: Process.cs 프로젝트: szbailin/Netch
 /// <summary>
 /// listBox右键菜单
 /// </summary>
 private void RuleListBox_MouseUp(object sender, MouseEventArgs e)
 {
     RuleListBox.SelectedIndex = RuleListBox.IndexFromPoint(e.X, e.Y);
     if (RuleListBox.SelectedIndex == -1)
     {
         return;
     }
     if (e.Button == MouseButtons.Right)
     {
         contextMenuStrip.Show(RuleListBox, e.Location);
     }
 }
예제 #2
0
 /// <summary>
 /// listBox右键菜单
 /// </summary>
 private void RuleListBox_MouseUp(object sender, MouseEventArgs e)
 {
     RuleListBox.SelectedIndex = RuleListBox.IndexFromPoint(e.X, e.Y);
     if (RuleListBox.SelectedIndex == -1)
     {
         return;
     }
     if (e.Button == MouseButtons.Right)
     {
         var strip = new ContextMenuStrip();
         strip.Items.Add(i18N.Translate("Delete"));
         strip.Items[0].Click += deleteRule_Click;
         strip.Show(RuleListBox, e.Location); //鼠标右键按下弹出菜单
     }
 }