革博士程序V1仓库
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.5 KiB

  1. using Models;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. namespace LeatherApp.UIExtend
  12. {
  13. public partial class UIDefectImage : UserControl
  14. {
  15. /// <summary>
  16. /// code,name
  17. /// </summary>
  18. public Action<string, string> CodeChangeEvent;
  19. public UIDefectImage()
  20. {
  21. InitializeComponent();
  22. init();
  23. }
  24. private void init()
  25. {
  26. var list = Config.defectItemList.Select(x => new { code = x.Value<string>("code"), name = x.Value<string>("name") }).ToList();
  27. uiComboBox1.ValueMember = "code";
  28. uiComboBox1.DisplayMember = "name";
  29. uiComboBox1.DataSource = list;
  30. }
  31. [Description("忽略"), Category("自定义")]
  32. public bool Checked
  33. {
  34. get { return this.uiCheckBox1.Checked; }
  35. set { this.uiCheckBox1.Checked = value; }
  36. }
  37. [Description("瑕疵"), Category("自定义")]
  38. public string Code
  39. {
  40. get { return this.uiComboBox1.SelectedValue.ToString(); }
  41. set { this.uiComboBox1.SelectedValue = value; }
  42. }
  43. [Description("瑕疵位置"), Category("自定义")]
  44. public string DefecLocation
  45. {
  46. set { this.lblLocation.Text = value; }
  47. }
  48. [Description("瑕疵图"), Category("自定义")]
  49. public Image Image
  50. {
  51. set { this.ucImageView1.loadImage(value); }
  52. }
  53. private void uiComboBox1_SelectedIndexChanged(object sender, EventArgs e)
  54. {
  55. string code = uiComboBox1.SelectedValue.ToString();
  56. string name = uiComboBox1.Text.ToString();
  57. if (this.Tag != null)//修改不起作用
  58. {
  59. var item = (DefectInfo)this.Tag;
  60. item.Code = code;
  61. item.Name = name;
  62. }
  63. API.OutputDebugString("AAAAAAAAA-"+code + " " + name);
  64. CodeChangeEvent?.Invoke(code,name);
  65. }
  66. private void ucImageView1_Load(object sender, EventArgs e)
  67. {
  68. uiCheckBox1.Left = this.uiComboBox1.Left + this.uiComboBox1.Width + 5;
  69. this.lblLocation.Left = this.uiCheckBox1.Left + uiCheckBox1.Width + 5;
  70. }
  71. }
  72. }