private void rMutualGraphDrawer(object sender, EventArgs e, RadioButton rbutton, Microsoft.Msagl.Drawing.Graph graph) { Microsoft.Msagl.GraphViewerGdi.GViewer viewer = new Microsoft.Msagl.GraphViewerGdi.GViewer(); graph.FindNode(rbutton.Text).Attr.FillColor = Microsoft.Msagl.Drawing.Color.Green; pictureBox1.Controls.Clear(); viewer.IsAccessible = false; viewer.ToolBarIsVisible = false; viewer.Graph = graph; pictureBox1.Controls.Add(viewer); viewer.FitGraphBoundingBox(); pictureBox1.ResumeLayout(); }
private void createGraph(ScoreNode root) { System.Windows.Forms.Form form = new System.Windows.Forms.Form(); Microsoft.Msagl.GraphViewerGdi.GViewer viewer = new Microsoft.Msagl.GraphViewerGdi.GViewer(); Microsoft.Msagl.Drawing.Graph graph = new Microsoft.Msagl.Drawing.Graph(this.name); graph = treeToGraph(root, graph); viewer.Graph = graph; viewer.AutoSize = true; viewer.FitGraphBoundingBox(); form.SuspendLayout(); form.Controls.Add(viewer); form.ResumeLayout(); form.ShowDialog(); }
private void button2_Click(object sender, EventArgs e) { if (comboBox1.Text != "" && (radioButton1.Checked || radioButton2.Checked)) { //////create a viewer object Microsoft.Msagl.GraphViewerGdi.GViewer viewer = new Microsoft.Msagl.GraphViewerGdi.GViewer(); //////create a graph object Microsoft.Msagl.Drawing.Graph graph = new Microsoft.Msagl.Drawing.Graph("graph"); //////create the graph content if (radioButton1.Checked) { graph = DFSHandler(); } else if (radioButton2.Checked) { graph = BFSHandler(); } graph.Directed = false; viewer.IsAccessible = false; viewer.ToolBarIsVisible = false; //////bind the graph to the viewer viewer.Graph = graph; //////associate the viewer with the form pictureBox1.SuspendLayout(); viewer.Dock = System.Windows.Forms.DockStyle.Fill; pictureBox1.Controls.Clear(); pictureBox1.Controls.Add(viewer); viewer.FitGraphBoundingBox(); pictureBox1.ResumeLayout(); Label label13 = new Label(); Size sLabel13 = new Size(250, 20); Point pLabel13 = new Point(36, 766); label13.Size = sLabel13; label13.Location = pLabel13; label13.Font = new Font("Segoe UI", 9, FontStyle.Bold); label13.Text = "Friends Recommendation for " + comboBox1.Text + " :"; Controls.Add(label13); handleMutualFriends(sender, e, graph); button2.Hide(); } }