コード例 #1
0
ファイル: Form1.cs プロジェクト: atikeee/AllGames
        private void button1_Click(object sender, EventArgs e)
        {
            string srcfile  = Path.Combine(Directory.GetCurrentDirectory(), "1.jpg");
            string srcfile2 = Path.Combine(Directory.GetCurrentDirectory(), "2.jpg");
            string desfile  = Path.Combine(Directory.GetCurrentDirectory(), "op");

            Image[] imgarr  = CropJoin.splitimg(srcfile, 10, 10);
            Image[] imgarr2 = CropJoin.splitimg(srcfile2, 10, 10);
            //Image[] imgarr_original = (Image[])imgarr.Clone();
            if (checkBox_ri.Checked)
            {
                CropJoin.shuffle(imgarr2);
            }
            CropJoin.shuffle(imgarr);
            Image img = CropJoin.combineimg(imgarr, 10, 10);

            CropJoin.overlayimg(img, imgarr2, 10, 10);
            CropJoin.saveimg(img, desfile);
            pictureBox1.Image = img;
            //CropJoin.saveimg(imgarr,desfile);
            string rndn = "";
            Random rnd  = new Random();
            int    n    = 10;

            while (n > 0)
            {
                int k = (rnd.Next(1, 100) % 100);
                n--;
                rndn += k.ToString() + "   ";
            }
            textBox1.Text = rndn;
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            string srcfile = Path.Combine(Directory.GetCurrentDirectory(), "allcards.jpg");
            //string srcfile2 = Path.Combine(Directory.GetCurrentDirectory(), "2.jpg");
            string desfile = Path.Combine(Directory.GetCurrentDirectory(), "op");

            Image[] imgarr = CropJoin.splitimg(srcfile, 4, 13);
            //Image[] imgarr2 = CropJoin.splitimg(srcfile2,10,10);
            //Image[] imgarr_original = (Image[])imgarr.Clone();
            //if (checkBox_ri.Checked)
            //{
            //    CropJoin.shuffle(imgarr2);
            //}
            CropJoin.shuffle(imgarr);
            Image img = CropJoin.combineimg(imgarr, 4, 13);

            //CropJoin.overlayimg(img,imgarr2,10,10);
            CropJoin.saveimg(img, desfile);
            pictureBox1.Image = img;
            //CropJoin.saveimg(imgarr,desfile);

            /*
             * imgarray = new Image[52];
             * for (int i = 0; i < 13; i++)
             * {
             *  for (int j = 0; j < 4; j++)
             *  {
             *      var index = i * 4 + j;
             *      Debug.Print(w1.ToString()+": "+h1.ToString());
             *      imgarray[index] = new Bitmap(w1, h1);
             *      var graphics = Graphics.FromImage(imgarray[index]);
             *      graphics.DrawImage(img, new Rectangle(0, 0, w1, h1), new Rectangle(i * w1, j * h1, w1, h1), GraphicsUnit.Pixel);
             *      graphics.Dispose();
             *  }
             * }
             * //pictureBox1.Image = imgrnd;
             *
             * Shuffle(listofindex);
             * var imgrnd = new Bitmap(w, h);
             * int rndidx = 0;
             * var graphics2 = Graphics.FromImage(imgrnd);
             * for (int i = 0; i < 13; i++)
             * {
             *  for (int j = 0; j < 4; j++)
             *  {
             *      var index = listofindex[rndidx];
             *      rndidx++;
             *      Debug.Print("Index: " + index);
             *      graphics2.DrawImage(imgarray[index], new Rectangle(i * w1, j * h1, w1, h1), new Rectangle(0, 0, w1, h1), GraphicsUnit.Pixel);
             *  }
             * }
             * graphics2.Dispose();
             * //pictureBox1.Image = imgarray[5];
             * pictureBox1.Image = imgrnd;
             * //pictureBox1.Image = imgarray[5];
             */
        }
コード例 #3
0
        private void reload()
        {
            if (splitcount < 1)
            {
                splitcount = 1;
            }
            textBox1.Text   = splitcount.ToString();
            button1.Enabled = true;
            button3.Enabled = true;
            if (curimgidx == 0)
            {
                button1.Enabled = false;
            }
            if (curimgidx == maximgcount - 1)
            {
                button3.Enabled = false;
            }
            Image[] imgarr = CropJoin.splitimg(allpictures[curimgidx], splitcount, splitcount);
            imgoriginal = (Image[])imgarr.Clone();
            Image imgpuzzle;

            if (radioButton1.Checked == true)
            {
                CropJoin.shuffle(imgarr);
                imgpuzzle         = CropJoin.combineimg(imgarr, splitcount, splitcount);
                pictureBox1.Image = imgpuzzle;
            }
            else if (radioButton2.Checked == true)
            {
                imgpuzzle         = CropJoin.removeimgpartially(imgarr, splitcount, splitcount, 5);
                pictureBox1.Image = imgpuzzle;
            }
            else if (radioButton3.Checked == true)
            {
                CropJoin.shuffle(imgarr);
                imgpuzzle         = CropJoin.removeimgpartially(imgarr, splitcount, splitcount, 2);
                pictureBox1.Image = imgpuzzle;
            }
            else if (radioButton4.Checked == true)
            {
                CropJoin.showimgpartially(imgarr, splitcount, splitcount, 5, pictureBox1);
            }
        }
コード例 #4
0
 private void solvepuzzle()
 {
     splitcount        = int.Parse(textBox1.Text);
     pictureBox1.Image = CropJoin.combineimg(imgoriginal, splitcount, splitcount);
 }