private void button2_Click(object sender, EventArgs e) { if (path == string.Empty || path == null) { MessageBox.Show("请选择扫描件存放路径!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } IsDeleteOld = checkBox1.Checked ? true : false; if (Directory.Exists(path)) { photoList = ImageClass.GetPhotoList(path); //ThreadStart delegate_thread = delegate() //{ // UploadYJ(); //}; //Thread thread_upload = new Thread(delegate_thread); //thread_upload.Start(); inputThread = new Thread(new ThreadStart(UploadYJ)); inputThread.Start(); this.button2.Enabled = false; timer1.Enabled = true; } }
//初始化图片和位置 private void PictureInit(string path) { Image img = ImageClass.GetThumbnail2(Image.FromFile(path), maxborder); FileImage = new Bitmap(img); SourceImage = FileImage; TempImage = FileImage; this.picImage.Image = FileImage; this.picImage.SizeMode = PictureBoxSizeMode.AutoSize; int x = (pnlImage.Width - picImage.Width) / 2; int y = (pnlImage.Height - picImage.Height) / 2; this.picImage.Location = new Point(x, y); }
private void btnOK_Click(object sender, EventArgs e) { double angle = 0; if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { angle += (double)list[i]; } } else { angle = (double)numericUpDown1.Value; } //取水平角度 if (angle > -90 && angle < -45) { angle += 90; } //取垂直角度 if (angle > 45 && angle < 90) { angle -= 90; } if (angle != 0) { Bitmap source = new Bitmap(ImagePath); Bitmap image = ImageClass.KiRotate(source, (float)angle, Color.White); source.Dispose(); image.Save(ImagePath); this.DialogResult = DialogResult.OK; } this.Close(); }
private void btnView_Click(object sender, EventArgs e) { if (Angle != 0) { list.Add(Angle); double angle = 0; for (int i = 0; i < list.Count; i++) { angle += (double)list[i]; } //取水平角度 if (angle > -90 && angle < -45) { angle += 90; } //取垂直角度 if (angle > 45 && angle < 90) { angle -= 90; } SourceImage = ImageClass.KiRotate(FileImage, (float)angle, Color.White); SourceImage = new Bitmap(ImageClass.GetThumbnail2(SourceImage, maxborder)); picImage.Image = SourceImage; TempImage = SourceImage; int x = (pnlImage.Width - picImage.Width) / 2; int y = (pnlImage.Height - picImage.Height) / 2; this.picImage.Location = new Point(x, y); Angle = 0; numericUpDown1.Value = 0; _originalPoint = new Point(0, 0); _lastPoint = new Point(0, 0); } }