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; }
public Form1() { speicher = new Speicher().laden(Directory.GetCurrentDirectory() + @"\Datenbank.txt"); InitializeComponent(); Temp_FormClosed(null, null); comBox.SelectedIndex = comBox.Items.Count - 1; }
public Speicher laden(string path) { if (!File.Exists(path)) { leeren(path); } Speicher erg = new Speicher(); FileStream FS = new FileStream(path, FileMode.Open); BinaryFormatter BF = new BinaryFormatter(); erg = (Speicher)BF.Deserialize(FS); FS.Dispose(); return(erg); }