public LevelEditor(Speicher speicher, int Level, bool Bearbeiten) { this.Level = Level; beatbeiten = Bearbeiten; InitializeComponent(); this.speicher = speicher; Breite = Hohe = 20; if (Bearbeiten) { return; } numHohe.Value = Breite = speicher.GetBreite(Level); numBreite.Value = Hohe = speicher.GetHohe(Level); Control[] Controls = speicher.GetControls(Level, new Size(panel1.Width / Breite, panel1.Height / Hohe)); for (int f = 0; f < Controls.Length; f++) { Console.WriteLine(Controls[f].Tag); Controls[f].MouseDown += Temp_MouseDown; Controls[f].MouseMove += Temp_MouseMove; Controls[f].MouseUp += Temp_MouseUp; panel1.Controls.Add(Controls[f]); } txBName.Text = speicher.GetName(Level); if (txBName.Text == "No Name") { txBName.Text = null; } button1.Visible = button2.Visible = true; }
private void Temp_FormClosed(object sender, FormClosedEventArgs e) { comBox.Items.Clear(); for (int f = 0; f < speicher.Length(); f++) { comBox.Items.Add("Level " + (f + 1) + " - " + speicher.GetName(f)); } comBox.Items.Add("Neues Level"); if (sender == null) { return; } switch (tag.Split(' ')[1]) { case "Level": comBox.SelectedIndex = comBox.Items.Count - 1; break; default: comBox.SelectedIndex = Convert.ToInt32(tag.Split(' ')[1]) - 1; break; } }