|
- using GeBoShi.SysCtrl;
- using Models;
- using OpenCvSharp.Extensions;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
-
- namespace GeBoShi.UI.InageShow
- {
- public partial class ImageShowFrm : Form
- {
- private List<DefectInfo> list;
- public List<DefectInfo> lstDel = new List<DefectInfo>();
-
- public ImageShowFrm(int imgindex, List<DefectInfo> lst, Image pic)
- {
- InitializeComponent();
- this.uiTitel1.FatherForm = this;
- this.uiTitel1.ShowContrlBox(false, false, true, false);
- UIStyle.SetUIStyle(this);
-
- this.pictureBox1.Image = pic;
- this.BackColor = SystemColors.ControlLightLight ;
- list = lst;
-
-
- }
-
- private void init()
- {
- SysMgr.Instance.LogMeg($"判断弹窗,原图索引({list[0].PhotoIndex})");
- this.label1.Text = $" 原图索引({list[0].PhotoIndex})";
- this.Text += $" 原图索引({list[0].PhotoIndex})";
- list.ForEach(item => {
- OpenCvSharp.Mat img = item.image;
- defectLabelImage userCon = new defectLabelImage()
- {
- Code = item.Code,
- Tag = item,
- DefecLocation = $"[{item.CentreX}cm,{Math.Round(item.CentreY / 100.0f, 2)}米]",
- Image = img
- };
- //userCon.CodeChangeEvent = (code, name) =>
- //{
- // item.Code = code;
- // item.Name = name;
- // API.OutputDebugString("BBBBBBBBBBB-" + item.Code+" "+ item.Name);
- //};
- this.flowLayoutPanel1.Controls.Add(userCon);
- });
- }
-
- private void btnOK_Click(object sender, EventArgs e)
- {
- for (int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++)
- {
- defectLabelImage userCon = this.flowLayoutPanel1.Controls[i] as defectLabelImage;
- if (userCon.Checked)
- {
- var item = (DefectInfo)userCon.Tag;
- lstDel.Add(item);
- list.Remove(item);
- }
- }
-
- this.DialogResult = DialogResult.OK;
- this.Close();
- }
-
- private void btnSkip_Click(object sender, EventArgs e)
- {
- for (int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++)
- {
- defectLabelImage userCon = this.flowLayoutPanel1.Controls[i] as defectLabelImage;
- var item = (DefectInfo)userCon.Tag;
- lstDel.Add(item);
- list.Remove(item);
- }
-
- this.DialogResult = DialogResult.OK;
- this.Close();
- }
-
- private void ImageShowFrm_Load(object sender, EventArgs e)
- {
- init();
- }
- }
- }
|