void ngp_OnRemove(gamePanel sender) { currentPanels.Remove(sender); sender.StopRunning(); sender.Dispose(); vertIndex = 0; horIndex = 1; foreach (gamePanel panel in currentPanels) { if (horIndex != 2)//This number is how many game panels wide it will be. Default is 2 { panel.Location = new Point(panel.Width * horIndex, (vertIndex * panel.Height) + toolstripOffset); panel.Show(); } else { horIndex = 0; vertIndex++; panel.Location = new Point(panel.Width * horIndex, (vertIndex * panel.Height) + toolstripOffset); } horIndex++; } this.Height = (_initGamepanel.Height * (vertIndex + 1)) + tbOffset + toolstripOffset; if (currentPanels.Count == 0) { this.Width = _initGamepanel.Width + 10; DontExtend = false; } }
void AddGamePanel(gamePanel ngp) { currentPanels.Add(ngp); ngp.OnRemove += ngp_OnRemove; ngp.SaveLog += WriteToFile; ngp.Parent = this; if (horIndex != 2)//This number is how many game panels wide it will be. Default is 2 { if (!DontExtend) { this.Width = (_initGamepanel.Width * (horIndex + 1)) + 10; } ngp.Location = new Point(ngp.Width * horIndex, (vertIndex * ngp.Height) + toolstripOffset); ngp.Show(); } else { DontExtend = true; horIndex = 0; vertIndex++; this.Height = (_initGamepanel.Height * (vertIndex + 1)) + tbOffset + toolstripOffset; ngp.Location = new Point(ngp.Width * horIndex, (vertIndex * ngp.Height) + toolstripOffset); } horIndex++; ngp.Show(); }
public Form1() { InitializeComponent(); _initGamepanel = new gamePanel(true); _initGamepanel.Parent = this; _initGamepanel.Location = new Point(0, toolstripOffset); _initGamepanel.SaveLog += WriteToFile; _initGamepanel.Show(); }
void AddGamePanel(gamePanel ngp) { currentPanels.Add(ngp); ngp.OnRemove += ngp_OnRemove; ngp.SaveLog += WriteToFile; ngp.Parent = this; if (horIndex != 2)//This number is how many game panels wide it will be. Default is 2 { if (!DontExtend) this.Width = (_initGamepanel.Width * (horIndex + 1)) + 10; ngp.Location = new Point(ngp.Width * horIndex, (vertIndex * ngp.Height) + toolstripOffset); ngp.Show(); } else { DontExtend = true; horIndex = 0; vertIndex++; this.Height = (_initGamepanel.Height * (vertIndex + 1)) + tbOffset + toolstripOffset; ngp.Location = new Point(ngp.Width * horIndex, (vertIndex * ngp.Height) + toolstripOffset); } horIndex++; ngp.Show(); }