public draw_gates(Form2 f, System.Drawing.Graphics g, int zoom, object_property std_img_size, System.Reflection.Assembly myAssembly, int nor_of_rows, int n_ip) { this.f = f; int cur_row = 0; int max_right_pad = 0; gate.n_or = 0; simplify_expression se = new simplify_expression(f.logical_exp); foreach (String val in se.str.Split(',')) { draw_gate_row.list.Clear(); draw_gate_row dgr = new draw_gate_row(f, g, zoom, std_img_size, myAssembly, nor_of_rows, n_ip, val, cur_row); if (object_property.panel_width > max_right_pad) { max_right_pad = object_property.panel_width; } cur_row = dgr.nor_of_row_taken; } if (f.panel1.Width != max_right_pad + 400) { f.panel1.Width = max_right_pad + 400; f.ckt_refresh(); } }
private void draw_ckt(int zoom) { //drawing circutes nor_of_rows = 0; simplify_expression se = new simplify_expression(logical_exp); label1.Text = se.str; foreach (String val in se.str.Split(',')) { divide_gates_for_row dgfr = new divide_gates_for_row(val); foreach (String v in dgfr.gates.Split('+')) { nor_of_rows += v.Split('@').Length; } } richTextBox1.AppendText("Origina exp=" + logical_exp + "\n"); Log.write_log("Origina exp=" + logical_exp + "\n"); richTextBox1.AppendText("Simplified exp=" + se.str + "\n"); Log.write_log("Simplified exp=" + se.str + "\n"); String img_file = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\guru\\ckt_" + object_property.file_count + ".png"; richTextBox1.AppendText("nor_of_rows=" + nor_of_rows + "\n"); Log.write_log("nor_of_rows=" + nor_of_rows + "\n"); richTextBox1.ScrollToCaret(); label2.Text = zoom.ToString(); System.Reflection.Assembly myAssembly = System.Reflection.Assembly.GetExecutingAssembly(); System.Drawing.Graphics g = panel1.CreateGraphics(); g.Clear(Color.White); draw_line(zoom, myAssembly, g); draw_Gates(zoom, myAssembly, g); g.Save(); ckt_img = new Bitmap(panel1.Width, panel1.Height + 100); Graphics g2 = Graphics.FromImage(ckt_img); g2.Clear(Color.White); draw_line(zoom, myAssembly, g2); draw_Gates(zoom, myAssembly, g2); new draw_string(se.str, g2, 30, panel1.Height + 20, System.Drawing.Color.Red, 11, panel1.Width, 40); new draw_string("Dr AIT Mini project CSE", g2, panel1.Width - 290, panel1.Height + 25, System.Drawing.Color.Red, 14, 290, 100); ckt_img.Save(img_file, ImageFormat.Png); panel1.Refresh(); // g.Dispose(); }