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; using AR; #if V22 using Euresys.Open_eVision_22_12; #else using Euresys.Open_eVision_2_11; #endif namespace Project { public partial class fviewer : Form { int Camidx = 0; EImageBW8 img = null; private arCtl.ImageBoxEvision iv1; public fviewer(int camidx) { InitializeComponent(); PUB.imgque.Push(this.Name); this.Camidx = camidx; //this.iv1 = new arCtl.ImageBoxEvision(); //this.iv1.BackColor = Color.Black; //this.iv1.Dock = DockStyle.Fill; //this.piv.Controls.Add(iv1); //iv1.Dock = DockStyle.Fill; //if (img_ != null) //{ // img = new EImageBW8(); // img.SetSize(img_); // img_.CopyTo(this.img); // EasyImage.Copy(img_, img); // this.iv1.Image = img; // this.iv1.Invalidate(); // this.iv1.ZoomFit(); //} this.KeyDown += (s1, e1) => { if (e1.KeyCode == Keys.Escape) this.Close(); }; this.FormClosed += FTeach_FormClosed; this.WindowState = FormWindowState.Maximized; } private void FTeach_FormClosed(object sender, FormClosedEventArgs e) { this.timer1.Stop(); PUB.imgque.Pop(); if (this.img != null) img.Dispose(); runtest = false; } private void fTeach_Load(object sender, EventArgs e) { this.timer1.Start(); } private void toolStripButton1_Click(object sender, EventArgs e) { //open file OpenFileDialog od = new OpenFileDialog(); if (od.ShowDialog() == DialogResult.OK) { if (this.img != null) this.img.Dispose(); img = new EImageBW8(); img.Load(od.FileName); this.iv1.Image = img; this.iv1.Invalidate(); this.iv1.ZoomFit(); } } Boolean runtest = false; int runcount = 0; private void toolStripButton4_Click(object sender, EventArgs e) { if (this.iv1.Image == null) { UTIL.MsgE("No image"); return; } var sd = new SaveFileDialog(); sd.FileName = "saveimage.bmp"; if (sd.ShowDialog() == DialogResult.OK) this.iv1.Image.Save(sd.FileName); } private void toolStripButton13_Click(object sender, EventArgs e) { this.iv1.DebugMode = !this.iv1.DebugMode; this.iv1.Invalidate(); } private void timer1_Tick(object sender, EventArgs e) { if (this.IsDisposed == true || this.Disposing == true) return; if (PUB.imgque.Peek().Equals(this.Name) == false) return; //카메라가 연결되지 않았따면 처리하지 않는다. if (PUB._isCrevisOpen[Camidx] == false || PUB.flag.get(eFlag.CAMERAINIT) == false) { } else { //이미지수집후 데이터 처리 if (PUB.CrevisGrab(this.Camidx, true,this.piv)) { //if (IsProcess[Camidx] || IsTrigger[Camidx]) PUB.CreavisProcess(Camidx, true, this.piv);// IsTrigger[Camidx]); } } //heart beat //this.BeginInvoke(new Action(() => //{ if (sbConnState.ForeColor == Color.Green) sbConnState.ForeColor = Color.LimeGreen; else sbConnState.ForeColor = Color.Green; //})); } private void piv_MouseClick(object sender, MouseEventArgs e) { this.Close(); } } }