Esempio n. 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)
     {
     }
 }
Esempio n. 2
0
        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();
        }
Esempio n. 3
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)
            {
            }
        }