public void Close() { if (Desktop == null) { return; } if (OnClosing != null) { var args = new SquidEventArgs(); OnClosing(this, args); if (args.Cancel) { return; } } Desktop.CloseDropdowns(); IsOpen = false; if (OnClosed != null) { OnClosed(this, null); } }
/// <summary> /// Opens this instance. /// </summary> public void Open() { if (OnOpening != null) { var args = new SquidEventArgs(); OnOpening(this, args); if (args.Cancel) { return; } } if (HotDrop && Dropdown.Controls.Count == 0) { return; } Dropdown.Owner = Parent; switch (Align) { case Alignment.BottomLeft: Dropdown.Position = Location + new Point(0, Size.y); break; case Alignment.TopRight: Dropdown.Position = Location + new Point(Size.x, 0); break; case Alignment.TopLeft: Dropdown.Position = Location - new Point(Dropdown.Size.x, 0); break; } Desktop.ShowDropdown(Dropdown, true); IsOpen = true; if (OnOpened != null) { OnOpened(this, null); } }
void Button_BeforeCheckedChanged(Control sender, SquidEventArgs args) { if (Button.Checked && Parent != null) { var valid = false; foreach (var btn in Parent.GetControls <RadioButton>()) { if (btn != this && btn.Group == Group) { if (btn.Checked) { valid = true; break; } } } if (!valid) { args.Cancel = true; } } }
public void Open() { if (OnOpening != null) { var args = new SquidEventArgs(); OnOpening(this, args); if (args.Cancel) { return; } } if (!_wasOpenOnce) { if (DropdownAutoSize) { Dropdown.Size = new Point(Size.X, DropdownSize.Y); } else { Dropdown.Size = new Point(DropdownSize.X, DropdownSize.Y); } _wasOpenOnce = true; } Dropdown.Position = Location + new Point(0, Size.Y); Desktop.ShowDropdown(Dropdown, false); IsOpen = true; if (OnOpened != null) { OnOpened(this, null); } }