Beispiel #1
0
 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)
     {
     }
 }
Beispiel #2
0
        private void PianoRollMainInnerPanel_MouseUp(object sender, MouseEventArgs e)
        {
            isMouseClicked = false;

            if (mMode == MouseMode.PENCIL_MODE)
            {
                Point sP = new Point(startPosition.X, startPosition.Y);
                Note  n  = new Note();

                n.Size      = new Size(25 * (int)pp, 20);
                n.BackColor = Color.Aquamarine;
                n.Location  = sP;
                n.p         = sP;
                n.x         = n.p.X / 25;
                n.y         = n.p.Y / 20;
                n.pKey      = pKeyIdx++;

                n.noteLevel     = NOTEPITCHMAX;
                n.noteLevel    -= (byte)n.y;
                n.noteTimeStamp = n.x * 250;
                n.noteDuration  = 250;

                noteDict.Add(n.pKey, n);
                PianoRollMainInnerPanel.Controls.Add(n);

                //toolStripStatusLabel1.Text = n.noteLevel.ToString();
                //toolStripStatusLabel2.Text = n.noteTimeStamp.ToString();
                //toolStripStatusLabel3.Text = n.pKey.ToString();
            }
            else if (mMode == MouseMode.SELECT_REGION_MODE)
            {
                // not implemented yet
                // select inner rectangle region
                for (int i = 0; i < noteDict.Count; i++)
                {
                    if (noteDict[i].p.X >= startPosition.X &&
                        noteDict[i].p.X <= endPosition.X &&
                        noteDict[i].p.Y >= startPosition.Y &&
                        noteDict[i].p.Y <= endPosition.Y)
                    {
                        noteDict[i].BackColor = Color.Violet;
                    }
                }
                Cursor = Cursors.Default;
                PianoRollMainInnerPanel.Refresh();
            }
            else if (mMode == MouseMode.SERIAL_PAINT_MODE)
            {
            }
        }