/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing) { m_button.Dispose(); m_textBox.Dispose(); } if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); }
private void AddComboBox() { TControl comboBox = null; comboBox = new TControl(drawWindow1, () => new RectangleF(IndexOfCombo(comboBox) * (COMBO_WIDTH + drawWindow1.Height), 0, COMBO_WIDTH, drawWindow1.Height), true, m_comboBoxItems, Fonts.Default); comboBox.RequestedAreaChanged += () => { MinimumSize = new Size(0, (int)comboBox.RequestedArea.Height); Size = m_comboBoxes.Select(b => b.RequestedArea.ToSize()).Aggregate(Size.Empty, (a, b) => new Size(a.Width + COMBO_WIDTH + drawWindow1.Height, Math.Max(a.Height, b.Height))); drawWindow1.Size = Size; //This should not be necessary, due to docking, but for some reason is. }; comboBox.RegisterCallbacks(m_focusProvider, drawWindow1); m_focusProvider.LastFocused = comboBox; comboBox.SelectionChanged += () => SelectionChanged(comboBox); if (Scheme != null) { SetupColors(Scheme, comboBox); } //comboBox.EnterPressed += () => { Ok.Execute(); }; m_comboBoxes.Add(comboBox); Size = m_comboBoxes.Select(b => b.RequestedArea.ToSize()).Aggregate(Size.Empty, (a, b) => new Size(a.Width + COMBO_WIDTH + drawWindow1.Height, Math.Max(a.Height, b.Height))); drawWindow1.Size = Size; //This should not be necessary, due to docking, but for some reason is. if (m_comboBoxes.Count > 1) { int i = m_comboBoxes.Count - 2; CrossButton button = null; try { button = new CrossButton(() => new RectangleF(i * (COMBO_WIDTH + drawWindow1.Height) + COMBO_WIDTH, 0, drawWindow1.Height, drawWindow1.Height), () => { Remove(i); }, Scheme.ControlBorder, Scheme.BackgroundBrush); button.RegisterCallbacks(m_focusProvider, drawWindow1); m_buttons.Add(button); button = null; } finally { if (button != null) { button.Dispose(); } } } }