示例#1
0
        private void ReSize()
        {
            a = 0;
            string fjpg = "";
            Bitmap bmp  = null;

            foreach (string name in names)
            {
                if (stop == false)
                {
                    a++;
                    fjpg = path1 + name + "." + ex;
                    if (File.Exists(fjpg))
                    {
                        bmp = PIC.GetBitmap(fjpg);
                        if (w == 0 && h == 0)
                        {
                            PIC.savejpg(PIC.zoom(bmp, 177, 254), path2 + "pics\\" + name + ".jpg", zl);
                            PIC.savejpg(PIC.zoom(bmp, 44, 64), path2 + "pics\\thumbnail\\" + name + ".jpg", zl);
                        }
                        else
                        {
                            PIC.savejpg(PIC.zoom(bmp, w, h), path2 + name + ".jpg", zl);
                        }
                    }
                    progressBar1.Invoke(pb1);
                    label1.Invoke(lb1);
                }
                else
                {
                    break;
                }
            }
            if (stop == true)
            {
                MessageBox.Show("已经取消!");
            }
            else
            {
                stop = true;
                MessageBox.Show("图片调整完成。\n文件在" + path2);
            }
            this.Invoke(fm);
        }
示例#2
0
        private void tabPage_jpg_DragDrop(object sender, DragEventArgs e)
        {
            if (textBox_code.Text.Length > 0)
            {
                if (e.Data.GetDataPresent(DataFormats.FileDrop))
                {
                    string str = ((System.Array)e.Data.GetData(DataFormats.FileDrop)).GetValue(0).ToString();

                    if (str.EndsWith("jpg", StringComparison.CurrentCultureIgnoreCase) || str.EndsWith("png", StringComparison.CurrentCultureIgnoreCase) || str.EndsWith("bmp", StringComparison.CurrentCultureIgnoreCase))
                    {
                        if (MessageBox.Show("是否把调整图片", "提示", MessageBoxButtons.YesNoCancel) == DialogResult.Yes)
                        {
                            CCFile.CheckFolder(SET.GamePath + "pics");
                            CCFile.CheckFolder(SET.GamePath + "pics\\thumbnail");
                            PIC.savejpg(PIC.zoom(PIC.GetBitmap(str), 177, 254), SET.GamePath + "pics\\" + textBox_code.Text + ".jpg", 96);
                            PIC.savejpg(PIC.zoom(PIC.GetBitmap(str), 44, 64), SET.GamePath + "pics\\thumbnail\\" + textBox_code.Text + ".jpg", 96);
                            MessageBox.Show("调整完成!");
                        }
                    }
                }
            }
        }