Example #1
0
        private void InitializeButtons()
        {
            SimonControl sc = new SimonControl(Simon.Properties.Resources.Red_OFF,
                                               Simon.Properties.Resources.Red_ON,
                                               "beep0");

            this.Controls.Add(sc);

            sc.Size     = Simon.Properties.Resources.Red_OFF.Size;
            sc.Location = new Point(centerCtrl.Location.X - sc.Width, centerCtrl.Location.Y - sc.Height);

            buttons.Add(sc);

            sc.pfPress = BtnPressed;
            sc.Tag     = 0;


            sc = new SimonControl(Simon.Properties.Resources.Green_OFF,
                                  Simon.Properties.Resources.Green_ON,
                                  "beep0");

            this.Controls.Add(sc);

            sc.Size     = Simon.Properties.Resources.Red_OFF.Size;
            sc.Location = new Point(centerCtrl.Location.X + centerCtrl.Width, centerCtrl.Location.Y - sc.Height);

            buttons.Add(sc);

            sc.pfPress = BtnPressed;
            sc.Tag     = 1;

            sc = new SimonControl(Simon.Properties.Resources.Blue_OFF,
                                  Simon.Properties.Resources.Blue_ON,
                                  "beep0");

            this.Controls.Add(sc);

            sc.Size     = Simon.Properties.Resources.Blue_OFF.Size;
            sc.Location = new Point(centerCtrl.Location.X + centerCtrl.Width, centerCtrl.Location.Y + centerCtrl.Height);

            buttons.Add(sc);

            sc.pfPress = BtnPressed;
            sc.Tag     = 2;

            sc = new SimonControl(Simon.Properties.Resources.Orange_OFF,
                                  Simon.Properties.Resources.Orange_ON,
                                  "beep0");

            this.Controls.Add(sc);

            sc.Size     = Simon.Properties.Resources.Orange_OFF.Size;
            sc.Location = new Point(centerCtrl.Location.X - sc.Width, centerCtrl.Location.Y + centerCtrl.Height);

            buttons.Add(sc);

            sc.pfPress = BtnPressed;
            sc.Tag     = 3;
        }
Example #2
0
        private void MainFrm_Load(object sender, EventArgs e)
        {
            SimonControl sc = new SimonControl(Simon.Properties.Resources.Center_OFF,
                                               Simon.Properties.Resources.Center_ON,
                                               "beep0");

            this.Controls.Add(sc);

            sc.pfCallback = StartButtonPress;

            sc.Size     = Simon.Properties.Resources.Center_OFF.Size;
            sc.Location = new Point(ClientSize.Width / 2 - sc.Width / 2, ClientSize.Height / 2 - sc.Height - 2);

            centerCtrl = sc;

            centerCtrl.AllowInput(true);

            InitializeButtons();
        }