private void savebtn_Click(object sender, EventArgs e) { for (int i = 0; i < tabControl1.TabPages.Count; i++) { ResultEntity temp = new ResultEntity(); for (int j = 0; j < tabControl1.TabPages[i].Controls[0].Controls.Count; j++) { if (tabControl1.TabPages[i].Controls[0].Controls[j].Name == "readytimevalue") { Settingentity settingentitytemp = (Settingentity)methodtemp.getsettinglist()[i]; settingentitytemp.setreadytime(int.Parse(tabControl1.TabPages[i].Controls[0].Controls[j].Text)); } else if (tabControl1.TabPages[i].Controls[0].Controls[j].Name == "namevalue") { Settingentity settingentitytemp = (Settingentity)methodtemp.getsettinglist()[i]; settingentitytemp.setparamatername(tabControl1.TabPages[i].Controls[0].Controls[j].Text.ToString()); } else if (tabControl1.TabPages[i].Controls[0].Controls[j].Name == "shuttertimevalue") { Settingentity settingentitytemp = (Settingentity)methodtemp.getsettinglist()[i]; settingentitytemp.setshuttertimes(int.Parse(tabControl1.TabPages[i].Controls[0].Controls[j].Text)); } else if (tabControl1.TabPages[i].Controls[0].Controls[j].Name == "clinevalue") { Settingentity settingentitytemp = (Settingentity)methodtemp.getsettinglist()[i]; settingentitytemp.setclinevalue(tabControl1.TabPages[i].Controls[0].Controls[j].Text.ToString()); } else if (tabControl1.TabPages[i].Controls[0].Controls[j].Name == "setstartvalue") { temp.setresultname("Control line"); temp.setresultstartvalue(int.Parse(tabControl1.TabPages[i].Controls[0].Controls[j].Text)); } else if (tabControl1.TabPages[i].Controls[0].Controls[j].Name == "setendvalue") { temp.setresultname("Control line"); temp.setresultendvalue(int.Parse(tabControl1.TabPages[i].Controls[0].Controls[j].Text)); } } Settingentity settingentitytempforresult = (Settingentity)methodtemp.getsettinglist()[i]; for (int k = 0; k < settingentitytempforresult.getresultentitylist().Count; k++) { if (((ResultEntity)settingentitytempforresult.getresultentitylist()[k]).getresultname() == "Control line") { settingentitytempforresult.getresultentitylist().RemoveAt(k); } } settingentitytempforresult.getresultentitylist().Add(temp); } Settingdetectsection settemp = new Settingdetectsection(method, formtemp, methodlisttemp, methodtemp, editflag); settemp.TopLevel = false; settemp.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; settemp.Dock = System.Windows.Forms.DockStyle.Fill; panel1.Controls.Clear(); panel1.Controls.Add(settemp); settemp.Show(); //formtemp.OnLoad(); //method.Dispose(); }
public MethodSettingEntity(Method formvalue, Form1 mainformvalue, MethodNext methodnexttempvalue, ArrayList valuelist, MethodEntity methodvalue, int value) { InitializeComponent(); if (Form1.language != "") { refreshlanguage(Form1.language); } methodtemp = methodvalue; methodnexttemp = methodnexttempvalue; settingentity = (Settingentity)methodvalue.getsettinglist()[value]; methodlisttemp = valuelist; form = formvalue; formtemp = mainformvalue; clinevalue.SelectedIndex = 0; namevalue.Text = settingentity.getparamatername(); }
private void addparamaterbtn_Click(object sender, EventArgs e) { Settingentity newsettingentity = new Settingentity(); newsettingentity.setparamatername(newparamatername); methodtemp.getsettinglist().Add(newsettingentity); TabPage tab = new TabPage(); tab.Name = newparamatername; tab.Text = newparamatername; MethodSettingEntity newmethodsettingentity = new MethodSettingEntity(form, formtemp, methodnexttemp, methodlisttemp, methodtemp, methodtemp.getsettinglist().Count - 1); newmethodsettingentity.TopLevel = false; tab.Controls.Add(newmethodsettingentity.panel1); methodnexttemp.tabControl1.TabPages.Add(tab); }
private void pictureBox1_MouseUp(object sender, MouseEventArgs e) { if (rectNew.Width - 1 > 0 && rectNew.Height - 1 > 0 && bitmapSource != null) { pointEndX = e.X; pointEndY = e.Y; bitmapSource = bitmap; ImageSampleEntity imagesample = new ImageSampleEntity(); Bitmap newbitmap = new Bitmap(rectNew.Width - 1, rectNew.Height - 1); Bitmap chartstacktemp = new Bitmap(pictureBox1.Width, pictureBox1.Height); pictureBox1.DrawToBitmap(chartstacktemp, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height)); chartstack.Add(chartstacktemp); g = Graphics.FromImage(newbitmap); g.DrawImage(bitmap, pictureBox1.Left - rectNew.Location.X - pictureBox1.Left - 1, pictureBox1.Top - rectNew.Location.Y - pictureBox1.Top - 1); g.Dispose(); newbitmap.Save(Environment.CurrentDirectory + "\\image\\" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".jpg"); tempform.chartstack = chartstack; tempform.rectNew = rectNew; tempform.pointStartX = pointStartX; tempform.pointStartY = pointStartY; tempform.pointEndX = pointEndX; tempform.pointEndY = pointEndY; tempform.frameheight = frameheight; tempform.framewidth = framewidth; Settingimageentity tempentity = new Settingimageentity(); tempentity.setimage(newbitmap); tempentity.setparamatername(name); tempform.paramatername = name; tempform.list1.Add(tempentity); for (int k = 0; k < tempform.methodtemp.getsettinglist().Count; k++) { if (((Settingentity)tempform.methodtemp.getsettinglist()[k]).getparamatername() == name) { Settingentity settingentity = ((Settingentity)tempform.methodtemp.getsettinglist()[k]); settingentity.getImageSample().setimagesample(rectNew.X * framewidth, rectNew.Y * frameheight, rectNew.Width * framewidth, rectNew.Height * frameheight); tempform.paramatertype = ((Settingentity)tempform.methodtemp.getsettinglist()[k]).getlinevalue(); tempentity.setparamatertype(((Settingentity)tempform.methodtemp.getsettinglist()[k]).getlinevalue()); } } tempform.neededboxes--; tempform.settingdetectsectionneededvaluelabel.Text = tempform.neededboxes.ToString(); } }
public Controlzoneentity(Bitmap imagevalue, Settingentity tempvalue, int tempframewidth, int tempframeheight)//set different areas for the control line and the test line { InitializeComponent(); if (Form1.language != "") { refreshlanguage(Form1.language); } image = imagevalue; orginalimage = (Bitmap)imagevalue.Clone(); image = new Bitmap(image, new Size(pictureBox1.Height, pictureBox1.Width)); image.RotateFlip(RotateFlipType.Rotate270FlipNone); pictureBox1.Image = image; chartstack.Add(image); comboBox1.SelectedIndex = 4; controlradiobtn.Checked = true; settingentity = tempvalue; settingentity.getImageSample().getcontrolzonelist().Clear(); framewidth = tempframewidth; frameheight = tempframeheight; }
private void methodeditaddbtn_Click(object sender, EventArgs e) { Settingentity tempsettingentity = new Settingentity(); Addparamater tempform = new Addparamater(tempsettingentity); }
public TestlineSetting(Settingentity value) { InitializeComponent(); settingentity = value; }
private void nextbtn_Click(object sender, EventArgs e) { MySqlDataReader mysqlreader = database.select("Methodtable", "Methodname"); while (mysqlreader.Read()) { if (mysqlreader[0].ToString().Equals(methodnamevalue.Text) && editflag == 0) { MessageBox.Show("method has been created"); return; } } ArrayList namelisttemp = new ArrayList(); methodtemp.setmethodname(methodnamevalue.Text); methodtemp.setsensitive(5); string line = namevalue.Text; //Regex reg = new Regex("[A-Za-z0-9]+"); string[] match = Regex.Split(line, ",| ,|, "); //MatchCollection match = reg.Matches(line); if (Paramaternumbertextbox.Text != "" && match.Length == int.Parse(Paramaternumbertextbox.Text)) { for (int i = 0; i < match.Length; i++) { Settingentity settingentity = new Settingentity(); string value = match[i].ToString(); namelisttemp.Add(value); settingentity.setparamatername(value); if (methodtemp.getsettinglist().Count > 0) { for (int j = 0; j < methodtemp.getsettinglist().Count; j++) { if (((Settingentity)methodtemp.getsettinglist()[j]).getparamatername() == value) { break; } else if (j == methodtemp.getsettinglist().Count - 1) { methodtemp.getsettinglist().Add(settingentity); } } } else { methodtemp.getsettinglist().Add(settingentity); } } //namelist = namelisttemp; MethodNext temp = new MethodNext(this, formtemp, methodlist, methodtemp, editflag); //MethodNext temp = new MethodNext(); temp.TopLevel = false; temp.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; temp.Dock = System.Windows.Forms.DockStyle.Fill; panel1.Controls.Clear(); panel1.Controls.Add(temp); for (int i = 0; i < namelisttemp.Count; i++) { TabPage tab = new TabPage(); tab.Name = (string)namelisttemp[i]; tab.Text = (string)namelisttemp[i]; MethodSettingEntity form = new MethodSettingEntity(this, formtemp, temp, methodlist, methodtemp, i); form.TopLevel = false; tab.Controls.Add(form.panel1); temp.tabControl1.TabPages.Add(tab); form.Show(); } temp.Show(); } else { MessageBox.Show("Please input correct number"); } }
public MethodSettingEntity(Settingentity value) { InitializeComponent(); settingentity = value; }
private void Settingdetectsectioncopybtn_Click(object sender, EventArgs e) { if (pictureBox1.Image != null) { if (chartstack.Count == 0) { bitmapSource = (Bitmap)pictureBox1.Image; Bitmap chartstacktemp = new Bitmap(pictureBox1.Width, pictureBox1.Height); pictureBox1.DrawToBitmap(chartstacktemp, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height)); chartstack.Add(chartstacktemp); } } if (chartstack.Count > 1) { for (int k = 0; k < list1.Count; k++) { Settingimageentity tempsettingimageeneity = (Settingimageentity)list1[k]; if (tempsettingimageeneity.getparamatername() == paramatername) { list1.RemoveAt(k); } } chartstack.RemoveAt(chartstack.Count - 1); pictureBox1.Image = (Bitmap)chartstack[chartstack.Count - 1]; pointStartX = copyStartX; pointEndX = copyEndX; pointEndY = copyEndY; pointStartY = copyStartY; int iWidth = copyEndX - copyStartX; int iHeight = copyEndY - copyStartY; if (chartstack.Count == 0) { bitmapSource = (Bitmap)pictureBox1.Image; } else { bitmapSource = (Bitmap)chartstack[chartstack.Count - 1]; } if (bitmapSource != null) { bitmap = new Bitmap(bitmapSource); Pen pen = new Pen(Color.White); Graphics gh = Graphics.FromImage(bitmap); rectNew = new Rectangle(pointStartX, pointStartY, iWidth, iHeight); gh.DrawRectangle(pen, rectNew); //this.CreateGraphics().DrawImage(bitmap, pictureBox1.Left, pictureBox1.Top, 500, 500); pictureBox1.Image = bitmap; bitmapSource = bitmap; // Graphics.FromImage(bitmap); // g.DrawImage(bitmap,rectNew); Bitmap newbitmap = new Bitmap(rectNew.Width - 1, rectNew.Height - 1); Bitmap chartstacktemp = new Bitmap(pictureBox1.Width, pictureBox1.Height); pictureBox1.DrawToBitmap(chartstacktemp, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height)); chartstack.Add(chartstacktemp); g = Graphics.FromImage(newbitmap); //g.DrawImage(bitmap, rectNew.Top, rectNew.Left); g.DrawImage(bitmap, pictureBox1.Left - rectNew.Location.X - pictureBox1.Left - 1, pictureBox1.Top - rectNew.Location.Y - pictureBox1.Top - 1); g.Dispose(); //newbitmap.Save("C:\\Users\\zsd\\Desktop\\" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".jpg"); Settingimageentity tempentity = new Settingimageentity(); tempentity.setparamatername(paramatername); tempentity.setimage(newbitmap); tempentity.setparamatertype(paramatertype); list1.Add(tempentity); ((Settingimagedetection)tabControl1.TabPages[tapindexi].Controls[0]).pointStartX = pointStartX; ((Settingimagedetection)tabControl1.TabPages[tapindexi].Controls[0]).pointStartY = pointStartY; ((Settingimagedetection)tabControl1.TabPages[tapindexi].Controls[0]).pointEndX = pointEndX; ((Settingimagedetection)tabControl1.TabPages[tapindexi].Controls[0]).pointEndY = pointEndY; for (int k = 0; k < methodtemp.getsettinglist().Count; k++) { Settingentity settingentity = (Settingentity)methodtemp.getsettinglist()[k]; if (settingentity.getparamatername() == paramatername) { settingentity.getImageSample().setimagesample(rectNew.X * framewidth, rectNew.Y * frameheight, rectNew.Width * framewidth, rectNew.Height * frameheight); break; } } blnDraw = false; neededboxes--; settingdetectsectionneededvaluelabel.Text = neededboxes.ToString(); } } else { pictureBox1.Image = (Bitmap)chartstack[chartstack.Count - 1]; pointStartX = copyStartX; pointEndX = copyEndX; pointEndY = copyEndY; pointStartY = copyStartY; int iWidth = copyEndX - copyStartX; int iHeight = copyEndY - copyStartY; if (chartstack.Count == 0) { bitmapSource = (Bitmap)pictureBox1.Image; } else { bitmapSource = (Bitmap)chartstack[chartstack.Count - 1]; } if (bitmapSource != null) { bitmap = new Bitmap(bitmapSource); Pen pen = new Pen(Color.White); Graphics gh = Graphics.FromImage(bitmap); rectNew = new Rectangle(pointStartX, pointStartY, iWidth, iHeight); gh.DrawRectangle(pen, rectNew); //this.CreateGraphics().DrawImage(bitmap, pictureBox1.Left, pictureBox1.Top, 500, 500); pictureBox1.Image = bitmap; bitmapSource = bitmap; // Graphics.FromImage(bitmap); // g.DrawImage(bitmap,rectNew); Bitmap newbitmap = new Bitmap(rectNew.Width - 1, rectNew.Height - 1); Bitmap chartstacktemp = new Bitmap(pictureBox1.Width, pictureBox1.Height); pictureBox1.DrawToBitmap(chartstacktemp, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height)); chartstack.Add(chartstacktemp); g = Graphics.FromImage(newbitmap); //g.DrawImage(bitmap, rectNew.Top, rectNew.Left); g.DrawImage(bitmap, pictureBox1.Left - rectNew.Location.X - pictureBox1.Left - 1, pictureBox1.Top - rectNew.Location.Y - pictureBox1.Top - 1); g.Dispose(); //newbitmap.Save("C:\\Users\\zsd\\Desktop\\" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".jpg"); Settingimageentity tempentity = new Settingimageentity(); tempentity.setparamatername(tabControl1.TabPages[tapindexi].Name.ToString()); tempentity.setimage(newbitmap); tempentity.setparamatertype(paramatertype); list1.Add(tempentity); ((Settingimagedetection)tabControl1.TabPages[tapindexi].Controls[0]).pointStartX = pointStartX; ((Settingimagedetection)tabControl1.TabPages[tapindexi].Controls[0]).pointStartY = pointStartY; ((Settingimagedetection)tabControl1.TabPages[tapindexi].Controls[0]).pointEndX = pointEndX; ((Settingimagedetection)tabControl1.TabPages[tapindexi].Controls[0]).pointEndY = pointEndY; for (int k = 0; k < methodtemp.getsettinglist().Count; k++) { Settingentity settingentity = (Settingentity)methodtemp.getsettinglist()[k]; if (settingentity.getparamatername() == paramatername) { settingentity.getImageSample().setimagesample(rectNew.X * framewidth, rectNew.Y * frameheight, rectNew.Width * framewidth, rectNew.Height * frameheight); break; } } blnDraw = false; neededboxes--; settingdetectsectionneededvaluelabel.Text = neededboxes.ToString(); } } }
private void upbtn_Click(object sender, EventArgs e) { if (chartstack.Count > 1) { pointStartY = pointStartY - 1; if (pointStartY >= 0) { pointEndY = pointEndY - 1; for (int k = 0; k < list1.Count; k++) { Settingimageentity tempsettingimageeneity = (Settingimageentity)list1[k]; if (tempsettingimageeneity.getparamatername() == paramatername) { list1.RemoveAt(k); } } chartstack.RemoveAt(chartstack.Count - 1); pictureBox1.Image = (Bitmap)chartstack[chartstack.Count - 1]; int iWidth = pointEndX - pointStartX; int iHeight = pointEndY - pointStartY; if (chartstack.Count == 0) { bitmapSource = (Bitmap)pictureBox1.Image; } else { bitmapSource = (Bitmap)chartstack[chartstack.Count - 1]; } if (bitmapSource != null) { //copy the original picture which is stored in bitmapsource and eliminate the old rectangle bitmap = new Bitmap(bitmapSource); Pen pen = new Pen(Color.White); Graphics gh = Graphics.FromImage(bitmap); rectNew = new Rectangle(pointStartX, pointStartY, iWidth, iHeight); //draw rectangle gh.DrawRectangle(pen, rectNew); // show it on the screen //this.CreateGraphics().DrawImage(bitmap, pictureBox1.Left, pictureBox1.Top, 500, 500); pictureBox1.Image = bitmap; bitmapSource = bitmap; // Graphics.FromImage(bitmap); // g.DrawImage(bitmap,rectNew); Bitmap newbitmap = new Bitmap(rectNew.Width - 1, rectNew.Height - 1); Bitmap chartstacktemp = new Bitmap(pictureBox1.Width, pictureBox1.Height); pictureBox1.DrawToBitmap(chartstacktemp, new Rectangle(0, 0, pictureBox1.Width, pictureBox1.Height)); chartstack.Add(chartstacktemp); g = Graphics.FromImage(newbitmap); //g.DrawImage(bitmap, rectNew.Top, rectNew.Left); g.DrawImage(bitmap, pictureBox1.Left - rectNew.Location.X - pictureBox1.Left - 1, pictureBox1.Top - rectNew.Location.Y - pictureBox1.Top - 1); g.Dispose(); //newbitmap.Save("D:\\" + DateTime.Now.ToString("yyyyMMddhhmmss") + ".jpg"); Settingimageentity tempentity = new Settingimageentity(); tempentity.setparamatername(paramatername); tempentity.setimage(newbitmap); tempentity.setparamatertype(paramatertype); list1.Add(tempentity); ((Settingimagedetection)tabControl1.TabPages[tapindexi].Controls[0]).pointStartX = pointStartX; ((Settingimagedetection)tabControl1.TabPages[tapindexi].Controls[0]).pointStartY = pointStartY; ((Settingimagedetection)tabControl1.TabPages[tapindexi].Controls[0]).pointEndX = pointEndX; ((Settingimagedetection)tabControl1.TabPages[tapindexi].Controls[0]).pointEndY = pointEndY; for (int k = 0; k < methodtemp.getsettinglist().Count; k++) { Settingentity settingentity = (Settingentity)methodtemp.getsettinglist()[k]; if (settingentity.getparamatername() == paramatername) { settingentity.getImageSample().setimagesample(rectNew.X * framewidth, rectNew.Y * frameheight, rectNew.Width * framewidth, rectNew.Height * frameheight); break; } } blnDraw = false; } } else { pointStartY = pointStartY + 1; } } }
public Addparamater(Settingentity tempvalue) { InitializeComponent(); settingentity = tempvalue; }