private void memoryList_MouseUp(object sender, MouseEventArgs e) { memoryListSelectionStart = null; selectionDirection = selectionDirections.notKnwown; if (mouseIsDown) showEditMemoryMenu(e); }
private void handleSelection(MouseEventArgs e) { if (memoryListSelectionStart != null) { Point localPoint = memoryList.PointToClient(Cursor.Position); ListViewItem itemUnderMouse = memoryList.GetItemAt(localPoint.X, localPoint.Y); if (itemUnderMouse != LastChangedItem) { if (selectionDirection == selectionDirections.notKnwown) { if (itemUnderMouse.Index <= LastChangedItem.Index) { selectionDirection = selectionDirections.Up; } else { selectionDirection = selectionDirections.Down; } } if (selectionDirection == selectionDirections.Up) { if (itemUnderMouse == memoryList.Items[LastChangedItem.Index - 1]) { itemUnderMouse.Selected = LastChangedItem.Selected; LastChangedItem = itemUnderMouse; } else if (itemUnderMouse == memoryList.Items[LastChangedItem.Index + 1]) { selectionDirection = selectionDirections.Down; LastChangedItem.Selected = !LastChangedItem.Selected; itemUnderMouse.Selected = LastChangedItem.Selected; LastChangedItem = itemUnderMouse; } } if (selectionDirection == selectionDirections.Down) { if (itemUnderMouse == memoryList.Items[LastChangedItem.Index + 1]) { itemUnderMouse.Selected = LastChangedItem.Selected; LastChangedItem = itemUnderMouse; } else if (itemUnderMouse == memoryList.Items[LastChangedItem.Index - 1]) { selectionDirection = selectionDirections.Up; LastChangedItem.Selected = !LastChangedItem.Selected; itemUnderMouse.Selected = LastChangedItem.Selected; LastChangedItem = itemUnderMouse; } } } } }
private void stackList_MouseMove(object sender, MouseEventArgs e) { //First the tooltip code ListViewHitTestInfo info = stackList.HitTest(e.X, e.Y); if (mLastPos != e.Location) { if (info.Item != null && info.SubItem != null) { mTooltip.Show(info.Item.ToolTipText, MainForm.getInstance(), Cursor.Position.X, Cursor.Position.Y + 30, 20000); } else { mTooltip.SetToolTip(MainForm.getInstance(), string.Empty); } } mLastPos = e.Location; //Now the rest if (memoryListSelectionStart != null) { Point localPoint = stackList.PointToClient(Cursor.Position); ListViewItem itemUnderMouse = stackList.GetItemAt(localPoint.X, localPoint.Y); if (itemUnderMouse != LastChangedItem) { if (selectionDirection == selectionDirections.notKnwown) { if (itemUnderMouse.Index <= LastChangedItem.Index) { selectionDirection = selectionDirections.Up; } else { selectionDirection = selectionDirections.Down; } } if (selectionDirection == selectionDirections.Up) { if (itemUnderMouse == stackList.Items[LastChangedItem.Index - 1]) { itemUnderMouse.Selected = itemUnderMouse.Selected = true; LastChangedItem = itemUnderMouse; for (int x = memoryListSelectionStart.Index; x <= itemUnderMouse.Index; ++x) { stackList.Items[x].Selected = LastChangedItem.Selected; } } } if (selectionDirection == selectionDirections.Down) { if (itemUnderMouse == stackList.Items[LastChangedItem.Index + 1]) { itemUnderMouse.Selected = true; LastChangedItem = itemUnderMouse; } } } } }