コード例 #1
0
        private void q1Click(object sender, EventArgs e)
        {
            PictureBox imgObj = sender as PictureBox;

            //this.Hide();

            if (imgObj.Tag == pictureBox1.Tag)
            {
                qanswers.Add(1);

                //this.Close();
            }
            else if (imgObj.Tag == pictureBox2.Tag)
            {
                qanswers.Add(2);
            }
            else
            {
                qanswers.Add(3);
            }
            bool           IsOpen = false;
            FormCollection fc     = Application.OpenForms;

            foreach (Form f in fc)
            {
                if (f.Name == "q2")
                {
                    IsOpen = true;
                    f.Focus();
                    break;
                }
            }

            if (IsOpen == false)
            {
                q2 form = new q2();
                form.Show();
            }
            this.Hide();
        }
コード例 #2
0
        private void q1Click(object sender, EventArgs e)
        {
            PictureBox imgObj = sender as PictureBox;

            //this.Hide();
            if (Convert.ToInt16(imgObj.Tag) == 1)
            {
                Form1.qanswers.Add(1);

                //this.Close();
            }
            else if (Convert.ToInt16(imgObj.Tag) == 2)
            {
                Form1.qanswers.Add(2);
            }
            else if (Convert.ToInt16(imgObj.Tag) == 3)
            {
                Form1.qanswers.Add(3);
            }
            //if (imgObj.Tag == pictureBox1.Tag)
            //{


            //    qanswers.Add(1);

            //    //this.Close();

            //}
            //else if (imgObj.Tag == pictureBox2.Tag)
            //{
            //    qanswers.Add(2);
            //}
            //else
            //{
            //   qanswers.Add(3);
            //}


            bool           IsOpen = false;
            FormCollection fc     = Application.OpenForms;

            foreach (Form f in fc)
            {
                if (f.Name == "q2")
                {
                    IsOpen = true;
                    f.Focus();
                    break;
                }
            }

            if (IsOpen == false)
            {
                q2 q2Obj = new q2();
                q2Obj.Show();
            }

            //Form1 f1obj = new Form1();
            this.Hide();

            //q2 q2Obj = new q2();
            //q2Obj.ShowDialog();
        }