public void Init(int id) { show = true; tid = id; tourData = UserProfile.InfoWorld.GetTournamentData(id); if (buttons != null) { foreach (Button button in buttons) { Controls.Remove(button); } } buttons = new Button[15]; for (int i = 0; i < 8; i++) { Button btn = MatchManager.GetButton(i, 131, 72 * i + 26); btn.Click += new EventHandler(button1_Click); Controls.Add(btn); buttons[i] = btn; } for (int i = 0; i < 4; i++) { Button btn = MatchManager.GetButton(i + 8, 249, 144 * i + 62); btn.Click += new EventHandler(button1_Click); Controls.Add(btn); buttons[i + 8] = btn; } for (int i = 0; i < 2; i++) { Button btn = MatchManager.GetButton(i + 12, 367, 288 * i + 135); btn.Click += new EventHandler(button1_Click); Controls.Add(btn); buttons[i + 12] = btn; } Button btn2 = MatchManager.GetButton(14, 485, 280); btn2.Click += new EventHandler(button1_Click); Controls.Add(btn2); buttons[14] = btn2; RefreshButtons(); Invalidate(); }
public void Init(int id) { show = true; tid = id; tourData = UserProfile.InfoWorld.GetTournamentData(id); TournamentConfig tournamentConfig = ConfigData.GetTournamentConfig(tid); if (tournamentConfig.PlayerCount > 4) { headSize = 24; gridSize = 36; } else { headSize = 36; gridSize = 50; } if (buttons != null) { foreach (Button button in buttons) { Controls.Remove(button); } } buttons = new Button[tournamentConfig.MatchCount]; for (int i = 0; i < tournamentConfig.MatchCount; i++) { Button btn = MatchManager.GetButton(i, 116, 18 + gridSize * i); btn.Click += new EventHandler(button1_Click); Controls.Add(btn); buttons[i] = btn; } RefreshButtons(); Height = Math.Max(410, tournamentConfig.MatchCount * gridSize); Invalidate(); }
public void Init(int id) { show = true; tid = id; tourData = UserProfile.InfoWorld.GetTournamentData(id); if (buttons != null) { foreach (Button button in buttons) { Controls.Remove(button); } } buttons = new Button[7]; for (int i = 0; i < 4; i++) { Button btn = MatchManager.GetButton(i, 152, 47 + 100 * i); btn.Click += new EventHandler(button1_Click); Controls.Add(btn); buttons[i] = btn; } for (int i = 0; i < 2; i++) { Button btn = MatchManager.GetButton(i + 4, 290, 97 + 200 * i); btn.Click += new EventHandler(button1_Click); Controls.Add(btn); buttons[i + 4] = btn; } Button btn2 = MatchManager.GetButton(6, 426, 197); btn2.Click += new EventHandler(button1_Click); Controls.Add(btn2); buttons[6] = btn2; RefreshButtons(); Invalidate(); }