革博士程序V1仓库
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

84 righe
2.6 KiB

  1. using LeatherApp.UIExtend;
  2. using Models;
  3. using Sunny.UI;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.ComponentModel;
  7. using System.Data;
  8. using System.Drawing;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows.Forms;
  13. namespace LeatherApp.Page
  14. {
  15. public partial class FHome_Defect : UIForm
  16. {
  17. private List<DefectInfo> list;
  18. public List<DefectInfo> lstDel = new List<DefectInfo>();
  19. public FHome_Defect(List<DefectInfo> lst)
  20. {
  21. InitializeComponent();
  22. list = lst;
  23. init();
  24. }
  25. private void init()
  26. {
  27. this.Text += $" 原图索引({list[0].PhotoIndex})";
  28. list.ForEach(item => {
  29. UIDefectImage userCon = new UIDefectImage()
  30. {
  31. Code = item.Code,
  32. Tag = item,
  33. DefecLocation=$"[{item.CentreX}cm,{Math.Round(item.CentreY/ 100.0f,2)}米]",
  34. Image = item.image
  35. };
  36. //userCon.CodeChangeEvent = (code, name) =>
  37. //{
  38. // item.Code = code;
  39. // item.Name = name;
  40. // API.OutputDebugString("BBBBBBBBBBB-" + item.Code+" "+ item.Name);
  41. //};
  42. this.flowLayoutPanel1.Controls.Add(userCon);
  43. });
  44. }
  45. private void FHome_Defect_Load(object sender, EventArgs e)
  46. {
  47. }
  48. private void btnOK_Click(object sender, EventArgs e)
  49. {
  50. for(int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++)
  51. {
  52. UIDefectImage userCon= this.flowLayoutPanel1.Controls[i] as UIDefectImage;
  53. if (userCon.Checked)
  54. {
  55. var item=(DefectInfo)userCon.Tag;
  56. lstDel.Add(item);
  57. list.Remove(item);
  58. }
  59. }
  60. this.DialogResult = DialogResult.OK;
  61. this.Close();
  62. }
  63. private void btnCancel_Click(object sender, EventArgs e)
  64. {
  65. for (int i = 0; i < this.flowLayoutPanel1.Controls.Count; i++)
  66. {
  67. UIDefectImage userCon = this.flowLayoutPanel1.Controls[i] as UIDefectImage;
  68. var item = (DefectInfo)userCon.Tag;
  69. lstDel.Add(item);
  70. list.Remove(item);
  71. }
  72. this.DialogResult = DialogResult.OK;
  73. this.Close();
  74. }
  75. }
  76. }