public SoundButtonMaker(int x, int y, int height, int width, string name) { Name = name; Data = new SoundButtonData(); SoundForm = new SelectSound(UpdateBtnText, Data); Btn = new Button(); Btn.Click += Btn_Click; Btn.Size = new Size(width * Scale, height * Scale); Btn.Location = new Point(Origin.X + x * Scale, Origin.Y + y * Scale); Btn.Text = name; Btn.TextAlign = ContentAlignment.TopCenter; Parent.Controls.Add(Btn); Parent.KeyPress += Form_KeyPress; }
virtual protected void Btn_Click(object sender, EventArgs e) { if (SoundForm == null) { SoundForm = new SelectSound(UpdateBtnText, Data); } try { SoundForm.LoadFromData(); SoundForm.Show(); } catch (ObjectDisposedException) { SoundForm = new SelectSound(UpdateBtnText, Data); SoundForm.Show(); } Form1.SetFocus(); }
public void Update() { SoundForm = new SelectSound(UpdateBtnText, Data); Btn.Text = Name + "\n" + Data.Name; }