private void Deactivate() { if (InDropDown) { Remove(dropdownbox); dropdownbox.Visible = false; SetFocus(); Invalidate(); DropDownStateChanged?.Invoke(this, false); } }
private void Activate() { bool activatable = Enabled && Items.Count > 0 && !InDropDown; if (activatable) { dropdownbox.SuspendLayout(); var p = FindScreenCoords(new Point(0, Height)); dropdownbox.Bounds = new Rectangle(p.X, p.Y, Width - ClientLeftMargin - ClientRightMargin, Height); dropdownbox.ScaleWindow = FindScaler(); dropdownbox.Name = Name + "-Dropdown"; dropdownbox.TopMost = true; dropdownbox.AutoSize = true; dropdownbox.Font = Font; dropdownbox.Visible = true; dropdownbox.ShowFocusBox = true; dropdownbox.HighlightSelectedItem = true; dropdownbox.ResumeLayout(); AddToDesktop(dropdownbox); // attach to display, not us, so it shows over everything DropDownStateChanged?.Invoke(this, true); dropdownbox.SetFocus(); } }