private void რედაქტირებაToolStripMenuItem_Click(object sender, EventArgs e) { Form3 Editform = new Form3(_product); Editform.Show(); }
private void histogramToolStripMenuItem_Click(object sender, EventArgs e) { for (int i = 0; i < 256; i++) { masR[i] = masG[i] = masB[i] = 0; } int R, G, B; Color color; toolStripProgressBar1.Maximum = X2 - X1; for (int i = X1; i < X2; i++) { toolStripProgressBar1.Value = i - X1; for (int j = Y1; j < Y2; j++) { color = Image_mem.GetPixel(i, j); R = color.R; G = color.G; B = color.B; masR[R]++; masG[G]++; masB[B]++; } } int maxR = 0, maxG = 0, maxB = 0; for (int i = 0; i < 256; i++) { if (maxR < masR[i]) { maxR = masR[i]; } if (maxG < masG[i]) { maxG = masG[i]; } if (maxB < masB[i]) { maxB = masB[i]; } } double mR, mG, mB; mR = (double)BMP_R.Height / maxR; mG = (double)BMP_G.Height / maxG; mB = (double)BMP_B.Height / maxB; Graphics gr_R = Graphics.FromImage(BMP_R); Graphics gr_G = Graphics.FromImage(BMP_G); Graphics gr_B = Graphics.FromImage(BMP_B); DialogResult dr = colorDialog1.ShowDialog(); if (dr == DialogResult.OK) { color = colorDialog1.Color; } else { color = System.Drawing.Color.Black; } Pen pen1 = new Pen(color, 1); Point[] poiR = new Point[256]; Point[] poiG = new Point[256]; Point[] poiB = new Point[256]; for (int i = 0; i < 256; i++) { poiR[i].X = i * 2; poiR[i].Y = BMP_R.Height - (int)(masR[i] * mR); poiG[i].X = i * 2; poiG[i].Y = BMP_G.Height - (int)(masG[i] * mG); poiB[i].X = i * 2; poiB[i].Y = BMP_B.Height - (int)(masB[i] * mB); } gr_R.DrawLines(pen1, poiR); gr_G.DrawLines(pen1, poiG); gr_B.DrawLines(pen1, poiB); Gist = new Form3(); Gist.Show(); Gist.pictureBox1.Image = new Bitmap(BMP_R); Gist.pictureBox2.Image = new Bitmap(BMP_G); Gist.pictureBox3.Image = new Bitmap(BMP_B); string maxRtxt = Convert.ToString(maxR); string maxGtxt = Convert.ToString(maxG); string maxBtxt = Convert.ToString(maxB); Gist.label1.Text = $"Max. R: {maxRtxt}"; Gist.label2.Text = $"Max. R: {maxGtxt}"; Gist.label3.Text = $"Max. R: {maxBtxt}"; }
private void readHistogramToolStripMenuItem_Click(object sender, EventArgs e) { FileStream fs = new FileStream("C:\\MARTIN/histogram.txt", FileMode.Open, FileAccess.Read); StreamReader sr = new StreamReader(fs, Encoding.UTF8); for (int i = 0; i < 256; i++) { masR[i] = masG[i] = masB[i] = 0; } string[] Liststr; string strArr = ""; while (sr.EndOfStream != true) { for (int i = 0; i < 256; i++) { strArr = sr.ReadLine(); Liststr = strArr.Split(' '); masR[i] += int.Parse(Liststr[0]); masG[i] += int.Parse(Liststr[1]); masB[i] += int.Parse(Liststr[2]); } } sr.Close(); fs.Close(); Color color; int maxR = 0, maxG = 0, maxB = 0; for (int i = 0; i < 256; i++) { if (maxR < masR[i]) { maxR = masR[i]; } if (maxG < masG[i]) { maxG = masG[i]; } if (maxB < masB[i]) { maxB = masB[i]; } } double mR, mG, mB; mR = (double)BMP_R.Height / maxR; mG = (double)BMP_G.Height / maxG; mB = (double)BMP_B.Height / maxB; Graphics gr_R = Graphics.FromImage(BMP_R); Graphics gr_G = Graphics.FromImage(BMP_G); Graphics gr_B = Graphics.FromImage(BMP_B); DialogResult dr = colorDialog1.ShowDialog(); if (dr == DialogResult.OK) { color = colorDialog1.Color; } else { color = System.Drawing.Color.Black; } Pen pen1 = new Pen(color, 1); Point[] poiR = new Point[256]; Point[] poiG = new Point[256]; Point[] poiB = new Point[256]; for (int i = 0; i < 256; i++) { poiR[i].X = i * 2; poiR[i].Y = BMP_R.Height - (int)(masR[i] * mR); poiG[i].X = i * 2; poiG[i].Y = BMP_G.Height - (int)(masG[i] * mG); poiB[i].X = i * 2; poiB[i].Y = BMP_B.Height - (int)(masB[i] * mB); } gr_R.DrawLines(pen1, poiR); gr_G.DrawLines(pen1, poiG); gr_B.DrawLines(pen1, poiB); Gist = new Form3(); Gist.Show(); Gist.pictureBox1.Image = new Bitmap(BMP_R); Gist.pictureBox2.Image = new Bitmap(BMP_G); Gist.pictureBox3.Image = new Bitmap(BMP_B); }
public Form4(Form3 fr3) { InitializeComponent(); f3 = fr3; }
private void pictureBox2_Click(object sender, EventArgs e) { Form gram = new Form3(); gram.Show(); }
public void zal_3(object sender, EventArgs e) { var btn = new Form3(); btn.Show(); }
private void ContextMenuStrip3_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { TreeNode CurSelectedNode = treeView1.SelectedNode; ToolStripItem Item1 = e.ClickedItem; var plc = pmg.FindPLCByName(CurSelectedNode.Name); if (Item1.Equals(this.contextMenuStrip3.Items[3])) { Form3 AddvarDlg = new Form3(this); if (AddvarDlg.ShowDialog() == DialogResult.OK) { MessageBox.Show("新增PLC变量成功"); } else { MessageBox.Show("取消增加PLC变量"); } AddvarDlg.Close(); } if (Item1.Equals(this.contextMenuStrip3.Items[1])) { try { plc.Open(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); return; //throw; } if (plc.IsConnected) { plc.CycleTimer.Enabled = true; plc.Node.BackColor = Color.Blue; } else { MessageBox.Show(string.Format($"{0} is not connected yet", plc.name)); } return; } if (Item1.Equals(this.contextMenuStrip3.Items[2])) { if (plc.IsConnected) { plc.CycleTimer.Enabled = false; plc.Close(); plc.Node.BackColor = Color.Black; MessageBox.Show("PLC has been closed!"); } else { MessageBox.Show(string.Format($"{0} is not connected yet", plc.name)); } } if (Item1.Equals(this.contextMenuStrip3.Items[0])) { if (plc.IsConnected) { MessageBox.Show("请断开当前PLC!"); return; } else { CurSelectedNode.Nodes.Remove(plc.Node); Pmg.del(plc); MessageBox.Show(string.Format($"PLC{0}已被删除", plc.name)); plc = null; return; } } }
private void button4_Click_2(object sender, EventArgs e) { Form form = new Form3(whitelist); form.ShowDialog(this); }
private void button2_Click(object sender, EventArgs e) { Form3 form3 = new Form3(); form3.Show(); }
private void Button2_Click(object sender, EventArgs e) { var form3 = new Form3(); form3.ShowDialog(); }
private void button2_Click(object sender, EventArgs e) { Form3 a = new Form3(); }
private void создатьЗапросToolStripMenuItem_Click(object sender, EventArgs e) { Form3 form3 = new Form3(this); form3.Show(); }
private void button1_Click(object sender, EventArgs e) { Form3 Ayuda = new Form3(); Ayuda.ShowDialog(); }
private void вычитаниеToolStripMenuItem_Click(object sender, EventArgs e) { Form vich = new Form3(); vich.Show(); }