版博士V2.0程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

72 regels
2.0 KiB

  1. using OpenCvSharp.Flann;
  2. using Org.BouncyCastle.Utilities.Collections;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.ComponentModel;
  6. using System.Data;
  7. using System.Drawing;
  8. using System.Linq;
  9. using System.Text;
  10. using System.Threading.Tasks;
  11. using System.Windows.Forms;
  12. namespace MaiMuAOI.SysUI.DefectPicShow
  13. {
  14. public partial class PhotoFrm : Form
  15. {
  16. private List<Bitmap> lstBmp = new List<Bitmap>();
  17. private int picIndex = 0;
  18. public PhotoFrm(List<Bitmap> list)
  19. {
  20. InitializeComponent();
  21. UIStyle.SetUIStyle(this);
  22. this.uiTitel1.FatherForm = this;
  23. lstBmp = list;
  24. }
  25. private void PhotoFrm_Shown(object sender, EventArgs e)
  26. {
  27. this.reloadPic(picIndex);
  28. }
  29. private void reloadPic(int index)
  30. {
  31. try
  32. {
  33. logsts.Text = $"第 {picIndex + 1}/{lstBmp.Count} 张";
  34. tsbtnPre.Enabled = (picIndex > 0);
  35. tsbtnNext.Enabled = (picIndex < lstBmp.Count - 1);
  36. Bitmap currBmp = (Bitmap)lstBmp[index];
  37. OpenCvSharp.Mat mat = OpenCvSharp.Extensions.BitmapConverter.ToMat(currBmp);//用bitmap转换为mat
  38. this.imageBox1.RefreshWindow(mat);
  39. //
  40. this.tsbtnPre.Enabled = (index > 0);
  41. this.tsbtnNext.Enabled = (index < lstBmp.Count - 1);
  42. }
  43. catch (Exception ex)
  44. {
  45. MessageBox.Show(ex.Message, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
  46. }
  47. }
  48. private void tsbtnExit_Click(object sender, EventArgs e)
  49. {
  50. this.Close();
  51. }
  52. private void tsbtnPre_Click(object sender, EventArgs e)
  53. {
  54. this.reloadPic(--picIndex);
  55. }
  56. private void tsbtnNext_Click(object sender, EventArgs e)
  57. {
  58. this.reloadPic(++picIndex);
  59. }
  60. }
  61. }