private void ulvDETemplates_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { // Change this to false if you want to maintain // the existing selection. //bool clearExisting = false; Point cursorPos = new Point(e.X, e.Y); UltraListView listView = sender as UltraListView; // Use the UltraListView's 'ItemFromPoint' method to hit test for an // UltraListViewItem. Note that we specify true for the 'selectableAreaOnly' // parameter, so that we only get a hit when the cursor is over the text // or image area of the item. UltraListViewItem itemAtPoint = listView.ItemFromPoint(cursorPos, true); // If we got a reference to an item, populate the context menu // accordingly and return if (itemAtPoint != null) { //this.ulvMethodsList.ContextMenuStrip = null; Infragistics.Win.ISelectionManager selectionManager = listView as Infragistics.Win.ISelectionManager; selectionManager.SelectItem(itemAtPoint, true); itemAtPoint.Activate(); contextMenuStrip1.Enabled = true; } else { contextMenuStrip1.Enabled = false; //this.ulvMethodsList.ContextMenuStrip = cmsListViewStyle; } } }
void ulvForms_MouseDown(object sender, MouseEventArgs e) { //this.pnlPrintSeriesPanel.Visible = false; if (e.Button == MouseButtons.Left) { this.lastMouseDown = e.Location; } else if (e.Button == MouseButtons.Right) { Point cursorPos = new Point(e.X, e.Y); UltraListView listView = sender as UltraListView; UltraListViewItem itemAtPoint = listView.ItemFromPoint(cursorPos, true); if (itemAtPoint != null) { Infragistics.Win.ISelectionManager selectionManager = listView as Infragistics.Win.ISelectionManager; selectionManager.SelectItem(itemAtPoint, true); itemAtPoint.Activate(); contextMenuStrip1.Enabled = true; contextMenuStrip1.Show(listView, new Point(e.X, e.Y)); } else { contextMenuStrip1.Enabled = false; } } else { this.lastMouseDown = new Point(); } }
void ulvFormSeries_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { Point cursorPos = new Point(e.X, e.Y); UltraListView listView = sender as UltraListView; UltraListViewItem itemAtPoint = listView.ItemFromPoint(cursorPos, true); if (itemAtPoint != null) { Infragistics.Win.ISelectionManager selectionManager = listView as Infragistics.Win.ISelectionManager; selectionManager.SelectItem(itemAtPoint, true); itemAtPoint.Activate(); contextMenuStrip2.Enabled = true; contextMenuStrip2.Show(listView, new Point(e.X, e.Y)); } else { contextMenuStrip2.Enabled = false; } } else if (e.Button == MouseButtons.Left) { Point cursorPos = new Point(e.X, e.Y); UltraListView listView = sender as UltraListView; UltraListViewItem itemAtPoint = listView.ItemFromPoint(cursorPos, true); if (itemAtPoint != null) { Infragistics.Win.ISelectionManager selectionManager = listView as Infragistics.Win.ISelectionManager; selectionManager.SelectItem(itemAtPoint, true); itemAtPoint.Activate(); FormSeries fs = FormSeriesDAO.DAO.Load(Convert.ToInt32(listView.SelectedItems[0].Key)); this.pnlPrintSeriesPanel.Visible = true; this.lblPrintSeriesName.Text = fs.Name + " Series"; this.loadPrintSeries(fs); } } }
void ulvPrintSeries_MouseDown(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { Point cursorPos = new Point(e.X, e.Y); UltraListView listView = sender as UltraListView; UltraListViewItem itemAtPoint = listView.ItemFromPoint(cursorPos, true); if (itemAtPoint != null) { Infragistics.Win.ISelectionManager selectionManager = listView as Infragistics.Win.ISelectionManager; selectionManager.SelectItem(itemAtPoint, true); itemAtPoint.Activate(); contextMenuStrip3.Enabled = true; contextMenuStrip3.Show(listView, new Point(e.X, e.Y)); } else { contextMenuStrip3.Enabled = false; } } }