123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- 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 HOZProject
- {
- public partial class FormShowImage : Form
- {
- #region 属性
- /// <summary>
- /// 显示的图像
- /// </summary>
- private Image showImg;
- public Image ShowImg { get => showImg; set => showImg = value; }
- /// <summary>
- /// 电压
- /// </summary>
- private string kv;
- public string Kv { get => kv; set => kv = value; }
- /// <summary>
- /// 放大倍数
- /// </summary>
- private string mag;
- public string Mag { get => mag; set => mag = value; }
- /// <summary>
- /// 属性信息(工作距离、消像散、亮度、对比度)
- /// </summary>
- private string content;
- public string Content { get => content; set => content = value; }
- /// <summary>
- /// Auto后显示的图像
- /// </summary>
- private Image showAutoImg;
- public Image ShowAutoImg { get => showAutoImg; set => showAutoImg = value; }
- /// <summary>
- /// Auto后电压
- /// </summary>
- private string autoKv;
- public string AutoKv { get => autoKv; set => autoKv = value; }
- /// <summary>
- /// Auto后放大倍数
- /// </summary>
- private string autoMag;
- public string AutoMag { get => autoMag; set => autoMag = value; }
- /// <summary>
- /// Auto后属性信息(工作距离、消像散、亮度、对比度)
- /// </summary>
- private string autoContent;
- public string AutoContent { get => autoContent; set => autoContent = value; }
- #endregion
- public FormShowImage()
- {
- InitializeComponent();
- Control.CheckForIllegalCrossThreadCalls = false;
- }
- #region 拖动窗体
- private Point mouseOff;//鼠标移动位置变量
- private bool leftFlag;//标签是否为左键
- private void FormShowImage_MouseDown(object sender, MouseEventArgs e)
- {
- if (e.Button == MouseButtons.Left)
- {
- mouseOff = new Point(-e.X, -e.Y); //得到变量的值
- leftFlag = true; //点击左键按下时标注为true;
- }
- }
- private void FormShowImage_MouseMove(object sender, MouseEventArgs e)
- {
- if (leftFlag)
- {
- Point mouseSet = Control.MousePosition;
- mouseSet.Offset(mouseOff.X, mouseOff.Y); //设置移动后的位置
- Location = mouseSet;
- }
- }
- private void FormShowImage_MouseUp(object sender, MouseEventArgs e)
- {
- if (leftFlag)
- {
- leftFlag = false;//释放鼠标后标注为false;
- }
- }
- #endregion
- private void picexit_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- #region 设置当前图像参数
- public void SetParaInfo()
- {
- lblMag.Text = Mag;
- lblContent.Text = Content;
-
- lblAutoMag.Text = "";
- lblAutoContent.Text = "";
- }
- public void SetAutoParaInfo()
- {
- lblAutoMag.Text = AutoMag;
- lblAutoContent.Text = AutoContent;
- }
- #endregion
- }
- }
|