예제 #1
0
 private void open_Click(object sender, EventArgs e)
 {
     if (input != null)
     {
         pictran.stop();
     }
     if (JPGEncoder.OpenFile(out input))
     {
         pictureBox1.Image = White;
         if (MathWork.max(input.Width, input.Height) > MAXWH)
         {
             double resized = (double)MAXWH / MathWork.max(input.Width, input.Height);
             MessageBox.Show("图像太大,将以" + MathWork.round(100 * resized).ToString() + "%的比例缩放显示图片。");
             Bitmap         bpt  = new Bitmap(MAXWH, MAXWH);
             Pictransformer ptmp = new Pictransformer();
             ptmp.start(input, progressBar1);
             ptmp.stretchpicture(resized, resized, Pictransformer.Stretching.Nearest, out bpt);
             pictureBox1.Image = bpt;
             ptmp.stop2();
         }
         else
         {
             pictureBox1.Image = input;
         }
         pictran.start(input, progressBar1);
         save.Enabled   = false;
         insert.Enabled = true;
     }
 }
예제 #2
0
 private void save_Click(object sender, EventArgs e)
 {
     JPGEncoder.SaveFile(output);
 }