public ComboBox(Manager manager) : base(manager) { Height = 20; Width = 64; ReadOnly = true; btnDown = new Button(Manager); btnDown.Init(); btnDown.Skin = new SkinControl(Manager.Skin.Controls["ComboBox.Button"]); btnDown.CanFocus = false; btnDown.Click += new EventHandler(btnDown_Click); Add(btnDown, false); lstCombo = new ListBox(Manager); lstCombo.Init(); lstCombo.HotTrack = true; lstCombo.Detached = true; lstCombo.Visible = false; lstCombo.Click += new EventHandler(lstCombo_Click); lstCombo.FocusLost += new EventHandler(lstCombo_FocusLost); lstCombo.Items = items; manager.Input.MouseDown += new MouseEventHandler(Input_MouseDown); }
protected override void Dispose(bool disposing) { if (disposing) { // We added the listbox to another parent than this control, so we dispose it manually if (lstCombo != null) { lstCombo.Dispose(); lstCombo = null; } Manager.Input.MouseDown -= Input_MouseDown; } base.Dispose(disposing); }