/// <summary> /// Raises the MouseDown event /// </summary> /// <param name="e">Event data</param> public virtual void OnMouseDown(MouseEventArgs e) { if (!Enabled) { return; } if (MouseDown != null) { MouseDown(this, e); } RibbonPopup pop = Canvas as RibbonPopup; if (pop != null) { if (ClosesDropDownAt(e.Location)) { RibbonPopupManager.Dismiss(RibbonPopupManager.DismissReason.ItemClicked); } OnClick(EventArgs.Empty); } SetPressed(true); }
private void _keyboardHook_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { RibbonPopupManager.Dismiss(RibbonPopupManager.DismissReason.EscapePressed); } }
/// <summary> /// Closes the DropDown if opened /// </summary> public void CloseDropDown() { if (DropDown != null) { RibbonPopupManager.Dismiss(DropDown, RibbonPopupManager.DismissReason.NewPopup); } SetDropDownVisible(false); }
/// <summary> /// Removes all helper controls placed by any reason. /// Contol's visibility is set to false before removed. /// </summary> private void RemoveHelperControls() { RibbonPopupManager.Dismiss(RibbonPopupManager.DismissReason.AppClicked); while (Controls.Count > 0) { Control ctl = Controls[0]; ctl.Visible = false; Controls.Remove(ctl); } }