2017-02-17 1 views
0

내 프로젝트에 ContextMenuStrip CMS가 있습니다. 그리고이 이벤트를 내 코드에 추가하려고하는데 마우스를 오른쪽 클릭 할 때 트리거되지 않습니다.ContextMenuStrip Opening 이벤트

메뉴가 나타나지만 이벤트가 호출되지 않습니다.

void cms_Opening(object sender, CancelEventArgs e) 
    { 
     // Code... 
    } 

일부 조건이 충족되는 경우 CMS가 열리는 것을 방지하기 위해이 이벤트를 처리하려고합니다.

감사합니다.

+0

전체 코드 첨부 – Jadeye

답변

0

이 코드는 관련 코드라고 생각합니다.

private void MenuTeam_ItemClicked(object sender, ToolStripItemClickedEventArgs e) 
    {    
     if (dgvMatches.CurrentCell != null && (dgvMatches.CurrentCell.ColumnIndex == 3 || dgvMatches.CurrentCell.ColumnIndex == 6)) 
     { 
      dgvMatches.CurrentCell.Value = e.ClickedItem.ToString(); 
      dgvMatches.CurrentCell = null; 
     } 
    } 
    private void MenuGolos_ItemClicked(object sender, ToolStripItemClickedEventArgs e) 
    { 

     if (dgvMatches.CurrentCell != null && (dgvMatches.CurrentCell.ColumnIndex == 4 || dgvMatches.CurrentCell.ColumnIndex == 5)) 
     { 
      dgvMatches.CurrentCell.Value = e.ClickedItem.ToString(); 
      dgvMatches.CurrentCell = null; 
     } 
    } 


    void MenuGolos_Opening(object sender, CancelEventArgs e) 
    { 
     if (dgvMatches.CurrentCell.ColumnIndex != 4 || dgvMatches.CurrentCell.ColumnIndex != 5) 
     { 
      MenuGolos.Close(); 
     } 
    } 

첫 번째 이벤트 2 개가 정상적으로 작동합니다. thrid 사람은 방아쇠를 당기지 않습니다.

감사합니다.