FormShowImage.cs 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace HOZProject
  11. {
  12. public partial class FormShowImage : Form
  13. {
  14. #region 属性
  15. /// <summary>
  16. /// 显示的图像
  17. /// </summary>
  18. private Image showImg;
  19. public Image ShowImg { get => showImg; set => showImg = value; }
  20. /// <summary>
  21. /// 电压
  22. /// </summary>
  23. private string kv;
  24. public string Kv { get => kv; set => kv = value; }
  25. /// <summary>
  26. /// 放大倍数
  27. /// </summary>
  28. private string mag;
  29. public string Mag { get => mag; set => mag = value; }
  30. /// <summary>
  31. /// 属性信息(工作距离、消像散、亮度、对比度)
  32. /// </summary>
  33. private string content;
  34. public string Content { get => content; set => content = value; }
  35. /// <summary>
  36. /// Auto后显示的图像
  37. /// </summary>
  38. private Image showAutoImg;
  39. public Image ShowAutoImg { get => showAutoImg; set => showAutoImg = value; }
  40. /// <summary>
  41. /// Auto后电压
  42. /// </summary>
  43. private string autoKv;
  44. public string AutoKv { get => autoKv; set => autoKv = value; }
  45. /// <summary>
  46. /// Auto后放大倍数
  47. /// </summary>
  48. private string autoMag;
  49. public string AutoMag { get => autoMag; set => autoMag = value; }
  50. /// <summary>
  51. /// Auto后属性信息(工作距离、消像散、亮度、对比度)
  52. /// </summary>
  53. private string autoContent;
  54. public string AutoContent { get => autoContent; set => autoContent = value; }
  55. #endregion
  56. public FormShowImage()
  57. {
  58. InitializeComponent();
  59. }
  60. #region 拖动窗体
  61. private Point mouseOff;//鼠标移动位置变量
  62. private bool leftFlag;//标签是否为左键
  63. private void FormShowImage_MouseDown(object sender, MouseEventArgs e)
  64. {
  65. if (e.Button == MouseButtons.Left)
  66. {
  67. mouseOff = new Point(-e.X, -e.Y); //得到变量的值
  68. leftFlag = true; //点击左键按下时标注为true;
  69. }
  70. }
  71. private void FormShowImage_MouseMove(object sender, MouseEventArgs e)
  72. {
  73. if (leftFlag)
  74. {
  75. Point mouseSet = Control.MousePosition;
  76. mouseSet.Offset(mouseOff.X, mouseOff.Y); //设置移动后的位置
  77. Location = mouseSet;
  78. }
  79. }
  80. private void FormShowImage_MouseUp(object sender, MouseEventArgs e)
  81. {
  82. if (leftFlag)
  83. {
  84. leftFlag = false;//释放鼠标后标注为false;
  85. }
  86. }
  87. #endregion
  88. private void picexit_Click(object sender, EventArgs e)
  89. {
  90. this.Close();
  91. }
  92. #region 设置当前图像参数
  93. public void SetParaInfo()
  94. {
  95. lblKV.Text = Kv;
  96. lblMag.Text = Mag;
  97. lblContent.Text = Content;
  98. lblAutoKV.Text = "";
  99. lblAutoMag.Text = "";
  100. lblAutoContent.Text = "";
  101. }
  102. public void SetAutoParaInfo()
  103. {
  104. lblAutoKV.Text = AutoKv;
  105. lblAutoMag.Text = AutoMag;
  106. lblAutoContent.Text = AutoContent;
  107. }
  108. #endregion
  109. }
  110. }