private void OffsetPanel_MouseMove(object sender, MouseEventArgs e) { if (dragging) { // Set offset to (mousePos - dragStart)/columnWidth/12 (round to octaves...?) int multiplier = (e.Location.X < dragStart.X ? -1 : 1); // Preserve sign if (isAdvanced) { int oldOffset = trackSelectionManager.MidiChannelOffsets.ContainsKey(dragTarget.Id) ? trackSelectionManager.MidiChannelOffsets[dragTarget.Id] : 0; trackSelectionManager.MidiChannelOffsets[dragTarget.Id] = startOffset + (int)Math.Round(((GetDistance(dragStart, e.Location) * multiplier / columnWidth)) / 12) * 12; if (trackSelectionManager.MidiChannelOffsets[dragTarget.Id] != oldOffset) { OffsetPanel.Refresh(); } } else { int oldOffset = trackSelectionManager.NoteOffset; trackSelectionManager.NoteOffset = startOffset + (int)Math.Round(((GetDistance(dragStart, e.Location) * multiplier / columnWidth)) / 12) * 12; if (trackSelectionManager.NoteOffset != oldOffset) { OffsetPanel.Refresh(); } } } //OffsetPanel.Refresh(); // See if this is laggy // Yeah a little }
private void OffsetPanel_MouseEnter(object sender, EventArgs e) => OffsetPanel.Refresh();
private void OffsetPanel_Resize(object sender, EventArgs e) { OffsetPanel.Refresh(); }