Exemple #1
0
        private void panel_MouseMove(object sender, MouseEventArgs e)
        {
            if (!_isDraging)
            {
                return;
            }
            Learn learn = new Learn();

            switch (sender.GetType().ToString())
            {
            case "System.Windows.Forms.Panel":
                cont0 = (Panel)sender;
                break;

            case "System.Windows.Forms.PictureBox":
                cont0 = (PictureBox)sender;
                break;
            }

            int x = cont0.Location.X + e.X - _diffPoint.Value.X;
            int y = cont0.Location.Y + e.Y - _diffPoint.Value.Y;

            if (x <= 0)
            {
                x = 0;
            }
            if (y <= 0)
            {
                y = 0;
            }
            cont0.Location        = new Point(x, y);
            learn.panel3.Location = new Point(x, y);
        }
Exemple #2
0
        //---------------------------
        private void panel_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            Cursor.Current = Cursors.Hand;
            _isDraging     = true;
            _diffPoint     = e.Location;

            Learn learn = new Learn();

            switch (sender.GetType().ToString())
            {
            case "System.Windows.Forms.Panel":
                cont0 = (Panel)sender;
                break;

            case "System.Windows.Forms.PictureBox":
                cont0 = (PictureBox)sender;
                break;
            }
            learn.panel3.Size     = cont0.Size;
            learn.panel3.Location = cont0.Location;
            cont0.BringToFront();
        }
Exemple #3
0
        private void quest1_Click(object sender, EventArgs e)
        {
            Form1 f1 = new Form1();

            switch (screenflg)
            {
            case 1:
                Learn learn = new Learn();
                learn.questNum                    = 1;
                learn.questTitle                  = "シールをかさねてイヌのかおをつくってね!";
                learn.BackgroundImage             = Image.FromFile(BG);
                learn.Learn_Group.BackgroundImage = Image.FromFile(BG);
                learn.Show();
                break;

            case 2:
                Review review = new Review();
                review.questNum   = 1;
                review.questTitle = "ぶひんをくみあわせてゴールまですすもう!";
                review.Show();
                break;

            case 3:
                //C1 c1 = new C1();
                //c1.Show();
                break;

            default:
                break;
            }
            //テスト------------------------------------
        }
Exemple #4
0
        private void panel_MouseUp(object sender, MouseEventArgs e)
        {
            Cursor.Current = Cursors.Default;
            _isDraging     = false;

            Learn learn = new Learn();

            if (e.Button != MouseButtons.Left)
            {
                return;
            }
        }
Exemple #5
0
        //------------------------------------------------------------------------

        //1問目の画像透過に必要な親の設定
        public void SetParent(Learn learn, string name, ArrayList array)
        {
            switch (name)
            {
            case "dog":
                //コントロール変数
                Control[] controls1 = new Control[0];
                Control[] controls2 = new Control[0];
                Control[] controls3 = new Control[0];
                //繰り返し変数
                int i = 0;
                while (array.Count > i)
                {
                    if (i == 1)
                    {    //二件目の処理
                        controls1 = learn.panel1.Controls.Find(array[0].ToString(), true);
                        foreach (Control control1 in controls1)
                        {
                            controls2 = learn.panel1.Controls.Find(array[1].ToString(), true);
                            foreach (Control control2 in controls2)
                            {
                                control2.Parent = control1;
                            }
                        }
                    }
                    if (i == 2)
                    {    //三件目の処理
                        controls2 = learn.panel1.Controls.Find(array[1].ToString(), true);
                        foreach (Control control2 in controls2)
                        {
                            controls3 = learn.panel1.Controls.Find(array[2].ToString(), true);
                            foreach (Control control3 in controls3)
                            {
                                control3.Parent = control2;
                            }
                        }
                    }
                    i++;
                }
                break;

            default:
                break;
            }
        }
Exemple #6
0
        //------------------------------------------------------------------------
        //部品の追加処理----------------------------------------------------------------------------------
        public void CreateControl(Size size, Point location, Learn learn, string kinds, string sender)
        {
            switch (kinds)
            {
            case "wani":
                //追加カウント
                Addcount++;
                //パネルインスタンス
                PictureBox wani = new PictureBox();
                //名前
                wani.Name = "wanipic_" + Addcount;
                //サイズ設定
                wani.SizeMode = PictureBoxSizeMode.Zoom;
                //サイズ
                wani.Size = size;
                //色
                wani.BackColor = Color.FromName("Transparent");
                //画像
                wani.Image = Image.FromFile(learn.FilePath + "\\images\\wani_block.png");
                //透過?
                Bitmap bitmap = new Bitmap(wani.Image);
                bitmap.MakeTransparent();
                //座標
                wani.Location = new Point(location.X - 379, location.Y - 64);
                //変形処理
                TransformControl(wani, "test");
                //イベントハンドラーの追加----------------------------------------------------------
                wani.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel_MouseDown);
                wani.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel_MouseMove);
                wani.MouseUp   += new System.Windows.Forms.MouseEventHandler(this.panel_MouseUp);
                //----------------------------------------------------------------------------------
                //作業領域に追加
                learn.panel1.Controls.Add(wani);
                //最前面に設定
                wani.BringToFront();
                //追加した部品の名前を保持-------------------------------------
                Array.Resize(ref learn.AddAnimal, learn.AddAnimal.Length + 1);
                learn.AddAnimal.SetValue(wani.Name, Addcount);
                //-------------------------------------------------------------
                break;

            case "dog":
                //パネルインスタンス
                PictureBox dog = new PictureBox();
                //作成判定フラグ
                Boolean flg = false;
                //名前、画像111
                switch (sender)
                {
                case "dog_face0":
                    if (dog1count == 0)
                    {
                        dog1count++;
                        dog.Name      = "dog_face" + dog1count;
                        dog.BackColor = Color.Transparent;
                        dog.Image     = Image.FromFile(learn.FilePath + "\\images\\DOG\\face.png");
                        dog.Parent    = learn.panel1;
                        dog1name      = dog.Name;
                        learn.questControl.Add(dog.Name);
                        if (dog2count == 1)
                        {
                            if (dog3count == 1)
                            {
                                dogAns[0] = 3;
                            }
                            else
                            {
                                dogAns[0] = 2;
                            }
                        }
                        else
                        {
                            dogAns[0] = 1;
                        }

                        flg = true;
                    }
                    break;

                case "dog_parts0":
                    if (dog2count == 0)
                    {
                        dog2count++;
                        dog.Name      = "dog_parts" + dog2count;
                        dog.BackColor = Color.Transparent;
                        dog.Image     = Image.FromFile(learn.FilePath + "\\images\\DOG\\parts.png");
                        dog2name      = dog.Name;
                        learn.questControl.Add(dog.Name);
                        if (dog1count == 1)
                        {
                            if (dog3count == 1)
                            {
                                dogAns[1] = 3;
                            }
                            else
                            {
                                dogAns[1] = 2;
                            }
                        }
                        else
                        {
                            dogAns[1] = 1;
                        }
                        flg = true;
                    }
                    break;

                case "dog_ears0":
                    if (dog3count == 0)
                    {
                        dog3count++;
                        dog.Name      = "dog_ears" + dog3count;
                        dog.BackColor = Color.Transparent;
                        dog.Image     = Image.FromFile(learn.FilePath + "\\images\\DOG\\ears.png");
                        dog3name      = dog.Name;
                        learn.questControl.Add(dog.Name);
                        if (dog1count == 1)
                        {
                            if (dog2count == 1)
                            {
                                dogAns[2] = 3;
                            }
                            else
                            {
                                dogAns[2] = 2;
                            }
                        }
                        else
                        {
                            dogAns[2] = 1;
                        }
                        flg = true;
                    }
                    break;
                }
                if (flg == true)
                {
                    //サイズ設定
                    dog.SizeMode = PictureBoxSizeMode.Zoom;
                    //サイズ
                    dog.Size = new Size(525, 300);
                    //座標
                    //dog.Location = new Point(location.X - 379, location.Y - 64);
                    dog.Location = new Point(0, 0);
                    //変形処理
                    //TransformControl(dog, "dog");
                    //イベントハンドラーの追加----------------------------------------------------------
                    dog.MouseDown += new System.Windows.Forms.MouseEventHandler(this.panel_MouseDown);
                    dog.MouseMove += new System.Windows.Forms.MouseEventHandler(this.panel_MouseMove);
                    dog.MouseUp   += new System.Windows.Forms.MouseEventHandler(this.panel_MouseUp);
                    //----------------------------------------------------------------------------------
                    //作業領域に追加
                    learn.panel1.Controls.Add(dog);
                    dog.BringToFront();
                }
                break;

            default:
                break;
            }
        }
Exemple #7
0
        private void CreateControl(string kinds, int num)
        {
            switch (kinds)
            {
            case "waniChara":
                Learn learn = new Learn();
                //パネルインスタンス
                PictureBox wani = new PictureBox();
                //名前
                wani.Name = "waniGif";
                //サイズ設定
                wani.SizeMode = PictureBoxSizeMode.Zoom;
                //サイズ
                wani.Size = new Size(200, 200);
                //画像
                if (talkflg == false)
                {
                    wani.Image = Image.FromFile(learn.FilePath + "\\images\\Idle.gif");
                }
                else if (talkflg == true)
                {
                    wani.Image = Image.FromFile(learn.FilePath + "\\images\\talk.gif");
                }

                //色
                wani.BackColor = Color.FromName("Transparent");
                //透過?
                Bitmap bitmap = new Bitmap(wani.Image);
                //bitmap.MakeTransparent(Color.FromArgb(0, 255, 255));
                //wani.Image = bitmap;
                //座標
                wani.Location = new Point(980, 388);
                //作業領域に追加
                panel1.Controls.Add(wani);
                //最前面に設定
                wani.BringToFront();
                break;

            case "docat":
                learn = new Learn();

                PictureBox docat0 = new PictureBox();
                PictureBox docat1 = new PictureBox();
                PictureBox docat2 = new PictureBox();
                PictureBox docat3 = new PictureBox();
                Label      n1     = new Label();
                Label      n2     = new Label();
                Label      n3     = new Label();

                string[] cards = { learn.FilePath + "\\images\\docat\\card1.png", learn.FilePath + "\\images\\docat\\card2.png", learn.FilePath + "\\images\\docat\\card3.png" };
                //番号
                n1.Text = "①";
                n2.Text = "②";
                n3.Text = "③";
                //番号サイズ
                n1.Font = new Font(n1.Font.FontFamily, 20);
                n2.Font = new Font(n2.Font.FontFamily, 20);
                n3.Font = new Font(n3.Font.FontFamily, 20);

                n1.Size = new Size(40, 40);
                n2.Size = new Size(40, 40);
                n3.Size = new Size(40, 40);


                //名前
                docat0.Name = "docat0";
                docat1.Name = "docat1";
                docat2.Name = "docat2";
                docat3.Name = "docat3";
                //サイズ設定
                docat0.SizeMode = PictureBoxSizeMode.StretchImage;
                docat1.SizeMode = PictureBoxSizeMode.StretchImage;
                docat2.SizeMode = PictureBoxSizeMode.StretchImage;
                docat3.SizeMode = PictureBoxSizeMode.StretchImage;
                //サイズ
                docat0.Size = new Size(160, 102);
                docat1.Size = new Size(500, 102);
                docat2.Size = new Size(500, 102);
                docat3.Size = new Size(500, 102);
                //色
                docat0.BackColor = Color.Transparent;
                docat1.BackColor = Color.Transparent;
                docat2.BackColor = Color.Transparent;
                docat3.BackColor = Color.Transparent;

                //座標
                docat0.Location = new Point(20, 10);
                docat1.Location = new Point(20, 120);
                docat2.Location = new Point(20, 230);
                docat3.Location = new Point(20, 340);


                //画像
                docat0.Image = Image.FromFile(learn.FilePath + "\\images\\docat\\card0.png");

                //カードをランダムで表示させる-------------------------------------------------------------------------------------------
                int   seed  = Environment.TickCount;
                int[] index = { 0, 0, 0 };
                for (int i = 0; i < 3; i++)
                {
                    //ランダムのインスタンス
                    Random rd = new Random(seed++);
                    //ランダムで0~2の乱数を保持
                    index[i] = (int)rd.Next(0, 3);
                    //ランダム処理------------------------------------------------------------------------------------
                    switch (i)
                    {
                    case 0:                                             //一枚目
                        docat1.Image = Image.FromFile(cards[index[0]]); //1
                        if (index[0] == 0)
                        {
                            docat1.Click += new EventHandler(this.docat_Click_Correct);
                        }
                        else
                        {
                            docat1.Click += new EventHandler(this.docat_Click);
                        }
                        break;

                    case 1:                           //二枚目
                        if (index[i - 1] == index[i]) //0
                        {
                            switch (index[i - 1])
                            {
                            case 0:
                                docat2.Image  = Image.FromFile(cards[index[i]]);
                                docat2.Click += new EventHandler(this.docat_Click);
                                break;

                            case 1:
                                Random rrr = new Random(seed++);
                                int    rda = rrr.Next(0, 2);
                                if (rda == 1)
                                {
                                    rda = 0;
                                }
                                docat2.Image = Image.FromFile(cards[rda]);
                                if (rda == 0)
                                {
                                    docat2.Click += new EventHandler(this.docat_Click_Correct);
                                }
                                else
                                {
                                    docat2.Click += new EventHandler(this.docat_Click);
                                }
                                break;

                            case 2:
                                rrr = new Random(seed++);
                                rda = rrr.Next(0, 1);
                                if (rda == 2)
                                {
                                    rda = 1;
                                }
                                docat2.Image = Image.FromFile(cards[rda]);
                                if (rda == 0)
                                {
                                    docat2.Click += new EventHandler(this.docat_Click_Correct);
                                }
                                else
                                {
                                    docat2.Click += new EventHandler(this.docat_Click);
                                }
                                break;

                            default:
                                break;
                            }
                        }
                        else
                        {
                            docat2.Image = Image.FromFile(cards[index[1]]);
                            if (index[1] == 0)
                            {
                                docat2.Click += new EventHandler(this.docat_Click_Correct);
                            }
                            else
                            {
                                docat2.Click += new EventHandler(this.docat_Click);
                            }
                        }
                        break;

                    case 2:                           //三枚目
                        if (index[i - 1] == index[i]) //1
                        {
                            switch (index[i - 1])
                            {
                            case 0:
                                if (index[i - 2] == 1)
                                {
                                    docat3.Image  = Image.FromFile(cards[2]);
                                    docat3.Click += new EventHandler(this.docat_Click);
                                }
                                else
                                {
                                    docat3.Image  = Image.FromFile(cards[1]);
                                    docat3.Click += new EventHandler(this.docat_Click);
                                }
                                break;

                            case 1:
                                if (index[i - 2] == 2)
                                {
                                    docat3.Image  = Image.FromFile(cards[0]);
                                    docat3.Click += new EventHandler(this.docat_Click_Correct);
                                }
                                else
                                {
                                    docat3.Image  = Image.FromFile(cards[2]);
                                    docat3.Click += new EventHandler(this.docat_Click);
                                }
                                break;

                            case 2:
                                if (index[i - 2] == 0)
                                {
                                    docat3.Image  = Image.FromFile(cards[1]);
                                    docat3.Click += new EventHandler(this.docat_Click);
                                }
                                else
                                {
                                    docat3.Image  = Image.FromFile(cards[0]);
                                    docat3.Click += new EventHandler(this.docat_Click_Correct);
                                }
                                break;

                            default:
                                break;
                            }
                        }
                        else if (index[i - 2] == index[i])            //[0]と[2]がかぶり [1]と[2]は別
                        {
                            switch (index[i - 2])
                            {
                            case 0:
                                if (index[1] == 1)
                                {
                                    docat3.Image  = Image.FromFile(cards[2]);
                                    docat3.Click += new EventHandler(this.docat_Click);
                                }
                                else if (index[1] == 2)
                                {
                                    docat3.Image  = Image.FromFile(cards[1]);
                                    docat3.Click += new EventHandler(this.docat_Click);
                                }
                                break;

                            case 1:
                                if (index[1] == 0)
                                {
                                    docat3.Image  = Image.FromFile(cards[2]);
                                    docat3.Click += new EventHandler(this.docat_Click);
                                }
                                else if (index[1] == 2)
                                {
                                    docat3.Image  = Image.FromFile(cards[0]);
                                    docat3.Click += new EventHandler(this.docat_Click_Correct);
                                }
                                break;

                            case 2:
                                if (index[1] == 0)
                                {
                                    docat3.Image  = Image.FromFile(cards[1]);
                                    docat3.Click += new EventHandler(this.docat_Click);
                                }
                                else if (index[1] == 1)
                                {
                                    docat3.Image  = Image.FromFile(cards[0]);
                                    docat3.Click += new EventHandler(this.docat_Click_Correct);
                                }
                                break;

                            default:
                                break;
                            }
                        }
                        else
                        {
                            docat3.Image = Image.FromFile(cards[index[2]]);
                            if (index[2] == 0)
                            {
                                docat3.Click += new EventHandler(this.docat_Click_Correct);
                            }
                            else
                            {
                                docat3.Click += new EventHandler(this.docat_Click);
                            }
                        }
                        break;
                    }
                }
                panel1.Controls.Add(docat0);
                panel1.Controls.Add(docat1);
                panel1.Controls.Add(docat2);
                panel1.Controls.Add(docat3);
                docat0.BringToFront();
                docat1.BringToFront();
                docat2.BringToFront();
                docat3.BringToFront();
                break;
            }
        }