public void Close() { if (Desktop == null) { return; } if (OnClosing != null) { SquidEventArgs 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) { SquidEventArgs 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) { bool valid = false; foreach (RadioButton 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) { SquidEventArgs 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); } }