using LeatherApp.UIExtend; using Models; using Sunny.UI; 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 LeatherApp.Page { public partial class FHome_Defect : UIForm { private List list; public List lstDel = new List(); public FHome_Defect(List lst) { InitializeComponent(); list = lst; init(); } private void init() { this.Text += $" 原图索引({list[0].PhotoIndex})"; list.ForEach(item => { UIDefectImage userCon = new UIDefectImage() { Code = item.Code, Tag = item, DefecLocation=$"[{item.CentreX}cm,{Math.Round(item.CentreY/ 100.0f,2)}米]", Image = item.image }; //userCon.CodeChangeEvent = (code, name) => //{ // item.Code = code; // item.Name = name; // API.OutputDebugString("BBBBBBBBBBB-" + item.Code+" "+ item.Name); //}; this.flowLayoutPanel1.Controls.Add(userCon); }); } private void FHome_Defect_Load(object sender, EventArgs e) { } private void btnOK_Click(object sender, EventArgs e) { for(int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++) { UIDefectImage userCon= this.flowLayoutPanel1.Controls[i] as UIDefectImage; if (userCon.Checked) { var item=(DefectInfo)userCon.Tag; lstDel.Add(item); list.Remove(item); } } this.DialogResult = DialogResult.OK; this.Close(); } private void btnCancel_Click(object sender, EventArgs e) { for (int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++) { UIDefectImage userCon = this.flowLayoutPanel1.Controls[i] as UIDefectImage; var item = (DefectInfo)userCon.Tag; lstDel.Add(item); list.Remove(item); } this.DialogResult = DialogResult.OK; this.Close(); } } }