//文件目录右键 private void listBox_right_click(object sender, MouseButtonEventArgs e) { MainWindow.POINT pit = new MainWindow.POINT(); MainWindow.GetCursorPos(out pit); //获取鼠标绝对位置 point = new Point(pit.X, pit.Y); AttributeWindow a = new AttributeWindow(listBox, true, point); a.ShowDialog(); showDialog = true; }
// //右键监听 protected override void OnMouseRightButtonDown(MouseButtonEventArgs e) { MainWindow.POINT pit = new MainWindow.POINT(); MainWindow.GetCursorPos(out pit); //获取鼠标绝对位置 StringBuilder sbAbs = new StringBuilder(); point = new Point(pit.X, pit.Y); if (!showDialog) { if (listBox.SelectedIndex != -1) { No_Select_State(); AttributeWindow a = new AttributeWindow(listBox, false, point); a.ShowDialog(); showDialog = false; } else if (treeView.SelectedItem != null) { No_Select_State(); AttributeWindow a = new AttributeWindow(listBox, false, point); a.ShowDialog(); } else { No_Select_State(); AttributeWindow a = new AttributeWindow(listBox, false, point); a.ShowDialog(); } } else { showDialog = false; } }