private void PianoRollMainInnerPanel_MouseMove(object sender, MouseEventArgs e) { if (mMode == MouseMode.PENCIL_MODE) { // do nothing } else if (mMode == MouseMode.SELECT_REGION_MODE) { if (isMouseClicked) { endPosition = new Point(e.X, e.Y); Rectangle rect = new Rectangle( startPosition.X, startPosition.Y, endPosition.X - startPosition.X, endPosition.Y - startPosition.Y); PianoRollMainInnerPanel.Refresh(); g = PianoRollMainInnerPanel.CreateGraphics(); g.DrawRectangle(greenPen, rect); g.Dispose(); } } else if (mMode == MouseMode.SERIAL_PAINT_MODE) { } }
private void InnerPanel_Paint(object sender, PaintEventArgs e) { g = PianoRollMainInnerPanel.CreateGraphics(); f = PianoRollPositionInnerPanel.CreateGraphics(); h = PianoRollPitchInnerPanel.CreateGraphics(); for (int i = 0, j = 0; i <= 130; i++, j++) { g.DrawLine(whitePen, i * 25, 0, i * 25, 25 * 128); if (i % 4 == 0) { g.DrawLine(redPen, i * 25, 0, i * 25, 25 * 128); f.DrawLine(whitePen, i * 25, 0, i * 25, 70); if (i % 16 == 0) { g.DrawLine(bluePen, i * 25, 0, i * 25, 25 * 128); } } if (j <= 120) { g.DrawLine(whitePen, 0, j * 20, 25 * 128, j * 20); h.DrawLine(whitePen, 0, j * 20, 70, j * 20); if (j % 12 == 0) { g.DrawLine(greenPen, 0, j * 20, 25 * 128, j * 20); h.DrawLine(greenPen, 0, j * 20, 70, j * 20); } } } h.Dispose(); f.Dispose(); g.Dispose(); }