void EventSoundItemMouseMove(object sender, MouseEventArgs e) { if ((status == SoundItemTreeStatus.Dragging) || (status == SoundItemTreeStatus.MouseDown)) { SoundItem sItem = (SoundItem) sender; Point oldLocation = sItem.Location; Point newLocation = snapToGrid(sItem.Location.X + e.X - draggingStart.X,sItem.Location.Y + e.Y - draggingStart.Y); if (!oldLocation.Equals(newLocation)) { status = SoundItemTreeStatus.Dragging; foreach(SoundItem sIt in this.soundItems) { if (sIt.Selected) { sIt.Location = new Point(sIt.Location.X + newLocation.X - oldLocation.X, sIt.Location.Y + newLocation.Y - oldLocation.Y); } } Invalidate(); Update(); } } }
void EventSoundItemMouseUp(object sender, MouseEventArgs e) { if (status == SoundItemTreeStatus.MouseDown) { status = SoundItemTreeStatus.Dragging; SoundItem sItem = (SoundItem) sender; UnselectAll(); sItem.Selected = true; } status = SoundItemTreeStatus.Default; }
void EventSoundItemMouseDown(object sender, MouseEventArgs e) { SoundItem sItem = (SoundItem) sender; if (Control.ModifierKeys == Keys.Control) { status = SoundItemTreeStatus.MouseDownControl; sItem.Selected = !sItem.Selected; } else { status = SoundItemTreeStatus.MouseDown; draggingStart = new Point(e.X,e.Y); PropertyGrid.SelectedObject = sItem.SoundBlock; if (!sItem.Selected) { UnselectAll(); sItem.Selected = true; } } }