//图像放大滑动条 private void trackBarImgEnlarge_Scroll(object sender, EventArgs e) { if (curImage != null) { pictureBoxCurImg.Image = curImage.enlargeBmp(trackBarImgEnlarge.Value); } if (preImage != null) { pictureBoxPreImg.Image = preImage.enlargeBmp(trackBarImgEnlarge.Value); } labelEnlargeTimes.Text = "放大:x" + trackBarImgEnlarge.Value.ToString(); }
private void updataImg() { if (curImage != null) { preImage = curImage; pictureBoxPreImg.Image = preImage.enlargeBmp(1); } curImage = new GrayBitmap(imgBuf, imgWidth, imgHeight); pictureBoxCurImg.Image = curImage.enlargeBmp(1); }
private void buttonImgLoadPre_Click(object sender, EventArgs e) { OpenFileDialog opndlg = new OpenFileDialog(); opndlg.Filter = "所有文件|*.bmp;*.jpg"; opndlg.Title = "打开图形文件"; opndlg.ShowHelp = true; if (opndlg.ShowDialog() == DialogResult.OK) { string curFileName = opndlg.FileName; try { Bitmap curBitmap = (Bitmap)Image.FromFile(curFileName); preImage = new GrayBitmap(curBitmap); pictureBoxPreImg.Image = preImage.enlargeBmp(1); } catch (Exception exp) { MessageBox.Show(exp.Message); } } }