geboshi_V1/LeatherProject/LeatherApp/Page/FHome_Defect.cs

84 lines
2.6 KiB
C#
Raw Normal View History

2024-03-07 14:03:22 +08:00
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<DefectInfo> list;
public List<DefectInfo> lstDel = new List<DefectInfo>();
public FHome_Defect(List<DefectInfo> 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();
}
}
}