private void button1_Click(object sender, EventArgs e) { hu = 1; string text; text = textBox1.Text; int checkHari = int.Parse(text); Microsoft.Msagl.GraphViewerGdi.GViewer viewer = new Microsoft.Msagl.GraphViewerGdi.GViewer(); GraphCity Graf = new GraphCity(); Graf.inputFromFile(); Graf.algortimaBFS(checkHari); viewer.Graph = Graf.guiGraph; panel1.SuspendLayout(); viewer.Dock = System.Windows.Forms.DockStyle.Fill; panel1.Controls.Clear(); panel1.Controls.Add(viewer); panel1.ResumeLayout(); int count = 0; panel2.Controls.Clear(); foreach (KeyValuePair <string, string> cek in Graf.jalurInfek.Values) { string val = cek.Value; string kal = cek.Key + "=>" + val; set_label(kal, count); count += 20; } }
private void Form1_Load(object sender, EventArgs e) { Microsoft.Msagl.GraphViewerGdi.GViewer viewer = new Microsoft.Msagl.GraphViewerGdi.GViewer(); GraphCity Graf = new GraphCity(); Graf.inputFromFile(); Graf.algortimaBFS(checkHari); viewer.Graph = Graf.guiGraph; panel1.SuspendLayout(); viewer.Dock = System.Windows.Forms.DockStyle.Fill; panel1.Controls.Clear(); panel1.Controls.Add(viewer); panel1.ResumeLayout(); // Adding this control to the form }