private void mouseMoved(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); rect = new Rectangle( startPosition.X, startPosition.Y, endPosition.X - startPosition.X, endPosition.Y - startPosition.Y); InnerPanel.Refresh(); g = InnerPanel.CreateGraphics(); g.DrawRectangle(greenPen, rect); g.Dispose(); } } else if (mMode == MouseMode.SERIAL_PAINT_MODE) { } }
private void leftMouseUp(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); InnerPanel.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; InnerPanel.Refresh(); } else if (mMode == MouseMode.SERIAL_PAINT_MODE) { } }
private void toolStripButton4_Click(object sender, EventArgs e) { if (pp == PanelGridSizeConst.HORIZONTAL_SINGLE) { pp = PanelGridSizeConst.HORIZONTAL_DOUBLE; } else if (pp == PanelGridSizeConst.HORIZONTAL_DOUBLE) { pp = PanelGridSizeConst.HORIZONTAL_TRIPLE; } else if (pp == PanelGridSizeConst.HORIZONTAL_TRIPLE) { pp = PanelGridSizeConst.HORIZONTAL_SINGLE; } for (int i = 0; i < noteDict.Count; i++) { noteDict[i].Width = 25 * (int)pp; noteDict[i].Location = new Point(noteDict[i].p.X * (int)pp, noteDict[i].p.Y); } InnerPanel.Refresh(); panel4.Refresh(); }