コード例 #1
0
ファイル: Graphs.cs プロジェクト: NastyaP1/GraphProgram
        private void DeleteEdgeBtn_Click(object sender, EventArgs e)
        {
            Graphics gr = CreateGraphics();
            int      n1 = graph.GetIndexByName(GetN1TB.Text);
            int      n2 = graph.GetIndexByName(GetN2TB.Text);

            graph.DeleteEdge(n1, n2);
            gr.Clear(DefaultBackColor);
            da.ShowGraph(gr, DefaultBackColor);
        }
コード例 #2
0
        public void DrawNode(Graphics graphics, NodeC node)
        {
            Pen        pen      = new Pen(Color.Black, 3);
            Font       font     = new Font("Arial", 10, FontStyle.Regular);
            SolidBrush sb       = new SolidBrush(node.color);
            SolidBrush sbstring = new SolidBrush(Color.Black);

            graphics.DrawEllipse(pen, node.x - radius, node.y - radius, 3 * radius, 3 * radius);
            graphics.FillEllipse(sb, node.x - radius, node.y - radius, 3 * radius, 3 * radius);
            graphics.DrawString(node.name + ":" + c.GetIndexByName(node.name) + ":" + node.NumberOfEnemies() + ":" + node.NumberOfFriends() + ":" + node.GroupNumber, font, sbstring, node.x, node.y);
            graphics.DrawString(node.names, font, Brushes.Black, node.x - 20, node.y - 27);

            //graphics.DrawString(c.GetIndexByName(node.name) + ":" + node.Count.ToString(), font, sbstring, node.x, node.y);
        }