革博士V2程序
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.

94 lines
3.0 KiB

  1. using Models;
  2. using OpenCvSharp.Extensions;
  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 GeBoShi.UI.InageShow
  13. {
  14. public partial class ImageShowFrm : Form
  15. {
  16. private List<DefectInfo> list;
  17. public List<DefectInfo> lstDel = new List<DefectInfo>();
  18. public ImageShowFrm(int imgindex, List<DefectInfo> lst, Image pic)
  19. {
  20. InitializeComponent();
  21. this.uiTitel1.FatherForm = this;
  22. this.uiTitel1.ShowContrlBox(false, false, true, false);
  23. UIStyle.SetUIStyle(this);
  24. this.pictureBox1.Image = pic;
  25. this.BackColor = SystemColors.ControlLightLight ;
  26. list = lst;
  27. }
  28. private void init()
  29. {
  30. this.label1.Text = $" 原图索引({list[0].PhotoIndex})";
  31. this.Text += $" 原图索引({list[0].PhotoIndex})";
  32. list.ForEach(item => {
  33. OpenCvSharp.Mat img = item.image;
  34. defectLabelImage userCon = new defectLabelImage()
  35. {
  36. Code = item.Code,
  37. Tag = item,
  38. DefecLocation = $"[{item.CentreX}cm,{Math.Round(item.CentreY / 100.0f, 2)}米]",
  39. Image = img
  40. };
  41. //userCon.CodeChangeEvent = (code, name) =>
  42. //{
  43. // item.Code = code;
  44. // item.Name = name;
  45. // API.OutputDebugString("BBBBBBBBBBB-" + item.Code+" "+ item.Name);
  46. //};
  47. this.flowLayoutPanel1.Controls.Add(userCon);
  48. });
  49. }
  50. private void btnOK_Click(object sender, EventArgs e)
  51. {
  52. for (int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++)
  53. {
  54. defectLabelImage userCon = this.flowLayoutPanel1.Controls[i] as defectLabelImage;
  55. if (userCon.Checked)
  56. {
  57. var item = (DefectInfo)userCon.Tag;
  58. lstDel.Add(item);
  59. list.Remove(item);
  60. }
  61. }
  62. this.DialogResult = DialogResult.OK;
  63. this.Close();
  64. }
  65. private void btnSkip_Click(object sender, EventArgs e)
  66. {
  67. for (int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++)
  68. {
  69. defectLabelImage userCon = this.flowLayoutPanel1.Controls[i] as defectLabelImage;
  70. var item = (DefectInfo)userCon.Tag;
  71. lstDel.Add(item);
  72. list.Remove(item);
  73. }
  74. this.DialogResult = DialogResult.OK;
  75. this.Close();
  76. }
  77. private void ImageShowFrm_Load(object sender, EventArgs e)
  78. {
  79. init();
  80. }
  81. }
  82. }