Esempio n. 1
0
        //基礎設定
        private List <Bitmap> BasicSet(int LineCount, int ScreenWidth, int ScreenHeight)
        {
            //尚未結束
            IsOver = false;

            //去除步數紀錄
            GameStar.Clear();
            User.Clear();


            //去除之前的參考圖
            this.Controls.Remove(ll);
            //參考圖
            Ref_bmp     = new Bitmap(bmp, Ref_size);
            ll          = new Label();
            ll.Location = Ref_Point;
            ll.Text     = "";
            ll.AutoSize = false;
            ll.Size     = Ref_bmp.Size;
            ll.Image    = Ref_bmp;
            this.Controls.Add(ll);


            //原圖先畫線
            _drawLine(LineCount, new Point(0, 0));
            //切割new_bmp(要先加入參考)
            Statistics.Screen sc = new Statistics.Screen(new_bmp, size.Width, size.Height, ScreenWidth, ScreenHeight);


            label1.Focus();

            //回傳切割後的圖片
            return(sc.Img);
        }
Esempio n. 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            //基礎設定
            if (!String.IsNullOrEmpty(textBox2.Text) && !String.IsNullOrEmpty(textBox3.Text))
            {
                width  = int.Parse(textBox2.Text);
                height = int.Parse(textBox3.Text);
            }
            String Extension = "";

            System.Drawing.Imaging.ImageFormat format;
            switch (comboBox1.SelectedIndex)
            {
            case 0:
                format    = System.Drawing.Imaging.ImageFormat.Jpeg;
                Extension = "jpg";
                break;

            case 1:
                format    = System.Drawing.Imaging.ImageFormat.Png;
                Extension = "png";
                break;

            case 2:
                format    = System.Drawing.Imaging.ImageFormat.Gif;
                Extension = "gif";
                break;

            case 3:
                format    = System.Drawing.Imaging.ImageFormat.Bmp;
                Extension = "bmp";
                break;

            default:
                format    = System.Drawing.Imaging.ImageFormat.Jpeg;
                Extension = "jpg";
                break;
            }



            //如果沒有裁切
            if (!checkBox1.Checked)
            {
                try
                {
                    for (int i = 0; i < _targetName.Count; i++)
                    {
                        Image  ii = Image.FromFile(_target[i]);
                        Bitmap bp = new Bitmap(ii, width, height);
                        //如果有浮水印


                        bp.Save(_SavePath + @"\" + "(處理)" + _targetName[i] + Extension, format);
                    }
                }
                catch (Exception ex) { MessageBox.Show(ex.ToString()); }
                finally { MessageBox.Show("處理完成"); }
            }
            else
            {
                try
                {
                    for (int i = 0; i < _targetName.Count; i++)
                    {
                        Image             ii = Image.FromFile(_target[i]);
                        Statistics.Screen sc = new Statistics.Screen(ii, width, height, int.Parse(textBox6.Text), int.Parse(textBox5.Text));
                        for (int j = 0; j < sc.Img.Count; j++)
                        {
                            sc.Img[j].Save(_SavePath + @"\" + "(處理)" + _targetName[i] + j + "." + Extension, format);
                        }
                    }
                }
                catch (Exception ex) { MessageBox.Show(ex.ToString()); }
                finally { MessageBox.Show("處理完成"); }
            }
        }