Ejemplo n.º 1
0
        private void DrawPianoButtons()
        {
            Muskey      mk;
            BlackMuskey bmk;

            /*  draw the white buttons*/
            for (int k = 0; k < 7; k++)
            {
                int pitch = whitePitch[k];
                int xPos  = k * 20;
                mk            = new Muskey(pitch, xPos, 50);
                mk.MouseDown += new MouseEventHandler(this.button1_MouseDown);
                mk.MouseDown += new MouseEventHandler(this.button1_MouseUp);
                this.panel1.Controls.Add(mk);
            }
            int Offs = 20;

            for (int k = 0; k < 5; k++)
            {
                int pitch = blackPitch[k];
                /*  note here we are using xPoss unlike in notes (xPos)*/
                int xPoss = xPos[k];
                bmk = new BlackMuskey(pitch, xPoss, 50);
                /*  note here we use bmk unlike in the notes*/
                bmk.MouseDown += new MouseEventHandler(this.button1_MouseDown);
                bmk.MouseDown += new MouseEventHandler(this.button1_MouseUp);
                this.panel1.Controls.Add(bmk);
                //this.panel1.Controls[this.panel1.Controls.Count-1].BringToFront();
                this.Controls[this.panel1.Controls.Count - 1].BringToFront();
            }
        }
Ejemplo n.º 2
0
        private void PianoForm_Load(object sender, EventArgs e)
        {
            //adding panel1 ~ the buttons
            this.panel1.Location = new Point(xLoc, yLoc);
            //this.panel1.BackColor = Color.Azure;
            this.panel1.Size = new Size(600, 200);
            this.Controls.Add(panel1);
            //adding the panel2 ~ the music lines.
            this.panel2.Location        = new Point(xLoc, 60);
            this.panel2.BackColor       = Color.Azure;
            this.panel2.BackgroundImage = Image.FromFile(@"C:\Users\desir\Documents\forkbasic\GodPiano\Piano2\Piano2\bin\Debug\Notes-Images\Staff2.bmp");
            //Image background = Image.FromFile(@"C:\Users\desir\Documents\forkbasic\GodPiano\Piano2\Piano2\bin\Debug\Notes-Images\Staff2.bmp");
            this.panel2.Size = new Size(600, 70);
            this.Controls.Add(panel2);



            Muskey      mk;
            BlackMuskey bmk;

            /*  draw the white buttons*/

            for (int k = 0; k < whitePitch.Length; k++)
            {
                int pitch = whitePitch[k];
                int xPos  = k * 40;//xPosition?
                mk            = new Muskey(pitch, xPos, 10);
                mk.Tag        = new Stopwatch();
                mk.MouseDown += new MouseEventHandler(this.button1_MouseDown);
                mk.MouseUp   += new MouseEventHandler(this.button1_MouseUp);
                this.panel1.Controls.Add(mk);
            }
            int Offs = 20;

            for (int k = 0; k < blackPitch.Length; k++)
            {
                int pitch = blackPitch[k];
                /*  note here we are using xPoss unlike in notes (xPos)*/
                int xP = xPos[k] * 2;
                bmk            = new BlackMuskey(pitch, xP, 10);
                bmk.Tag        = new Stopwatch();
                bmk.MouseDown += new MouseEventHandler(this.button1_MouseDown);
                bmk.MouseUp   += new MouseEventHandler(this.button1_MouseUp);
                this.panel1.Controls.Add(bmk);
                this.panel1.Controls[this.panel1.Controls.Count - 1].BringToFront();
            }
        }
Ejemplo n.º 3
0
        private void PianoForm_Load(object sender, EventArgs e)
        {
            this.panel1.Location = new Point(xLoc, yLoc);
            //this.panel1.BackColor = Color.Azure;
            this.panel1.Size = new Size(600, 200);
            this.Controls.Add(panel1);

            Muskey      mk;
            BlackMuskey bmk;

            /*  draw the white buttons*/

            for (int k = 0; k < whitePitch.Length; k++)
            {
                int pitch = whitePitch[k];
                int xPos  = k * 40;
                mk            = new Muskey(pitch, xPos, 10);
                mk.MouseDown += new MouseEventHandler(this.button1_MouseDown);
                mk.MouseDown += new MouseEventHandler(this.button1_MouseUp);
                this.panel1.Controls.Add(mk);
            }
            int Offs = 20;

            for (int k = 0; k < blackPitch.Length; k++)
            {
                int pitch = blackPitch[k];
                /*  note here we are using xPoss unlike in notes (xPos)*/
                int xP = xPos[k] * 2;
                bmk = new BlackMuskey(pitch, xP, 10);
                /*  note here we use bmk unlike in the notes*/
                bmk.MouseDown += new MouseEventHandler(this.button1_MouseDown);
                bmk.MouseDown += new MouseEventHandler(this.button1_MouseUp);
                this.panel1.Controls.Add(bmk);
                this.panel1.Controls[this.panel1.Controls.Count - 1].BringToFront();
            }



            #region
            //DrawPianoButtons();
            //this.btnAdd.BackColor = Color.Gray;
            //this.btnAdd.Text = "Add";
            //this.btnAdd.Location = new Point(90, 25);
            //this.btnAdd.Size =new Size(50, 25);
            //this.Controls.Add(btnAdd);
            #endregion
        }