mali

mali

  • NA
  • 60
  • 0

list view + contextmenustrip

Oct 9 2008 5:07 PM

Hii everyone

I try this code. The menu itself is working  but it's showing no matter where I right-click in the ListView.  how can i hide the contextmenu when the row is empty?

Thanks

private void listViewCalendar_MouseDown(object sender, MouseEventArgs e)

{

Point p = new Point(e.X, e.Y);

if (e.Button == MouseButtons.Right )

{

ListViewItem lvi = this.listViewCalendar.GetItemAt(p.X, p.Y);

if (lvi != null && listViewCalendar.SelectedItems.Count ==1)

{

this.myContext.Show(this.listViewCalendar, p);

}

}

}


Answers (4)