示例#1
0
 private void panel1_Resize(object sender, EventArgs e)
 {
     for (int i = 0; i < buttons.Count; i++)
         buttons[i].Dispose();
     int n = names.Count;
     getPoints(panel1.Width / 2, panel1.Height / 2 - 15, panel1.Width / 3.2, n);
     NodeData nd = new NodeData(1, 1);
 }
示例#2
0
 private void drawButtons(int x, int y, int i, int n)
 {
     if (i == 0)
     {
         Button button = new Button
         {
             FlatStyle = FlatStyle.Flat,
             Text = "Stacja bazowa",
             Name = names[i],
             BackColor = Color.Black,
             ForeColor = Color.White,
             Location = new Point(x, y),
             Size = new Size(115, (int)(-0.45 * n + 54.5))     // optymalna dla n = 10 to (50, 50) ||| n = 50 to (32, 32)
         };
         button.Click += new EventHandler(NewButton_Click);
         panel1.Controls.Add(button);
         buttons.Add(button);
         NodeData nd = new NodeData(int.Parse(names[i]), names.Count);
         nodes.Add(nd);
         pos.Add(new Point(x + (115/2), y + (((int)(-0.45 * n + 54.5))/2)));
     }
     else
     {
         Button button = new Button
         {
             FlatStyle = FlatStyle.Flat,
             Text = names[i],
             Name = names[i],
             BackColor = Color.Black,
             ForeColor = Color.White,
             Location = new Point(x, y),
             Size = new Size((int)(-0.45 * n + 54.5), (int)(-0.45 * n + 54.5))     // optymalna dla n = 10 to (50, 50) ||| n = 50 to (32, 32)
         };
         button.Click += new EventHandler(NewButton_Click);
         panel1.Controls.Add(button);
         buttons.Add(button);
         NodeData nd = new NodeData(int.Parse(names[i]), names.Count);
         nodes.Add(nd);
         pos.Add(new Point(x + (((int)(-0.45 * n + 54.5))/2), y + (((int)(-0.45 * n + 54.5))/2)));
     }
 }