protected virtual void OnSplitClick(SplitMenuEventArgs e) { SplitClick?.Invoke(this, e); if (SplitMenu == null && SplitMenuStrip == null) { return; } SplitMenuOpening?.Invoke(this, e); if (e.PreventOpening) { return; } var pBottomLeft = new System.Drawing.Point(e.DrawArea.Left, e.DrawArea.Bottom); if (SplitMenu != null) { SplitMenu.Show(this, pBottomLeft); } else if (SplitMenuStrip != null) { SplitMenuStrip.Width = e.DrawArea.Width; SplitMenuStrip.Show(this, pBottomLeft); } }
protected virtual void OnSplitClick(SplitMenuEventArgs e) { //Raise opening event before opening any menu if (SplitMenuOpening != null && (SplitMenu != null || SplitMenuStrip != null)) { SplitMenuOpening(this, e); } Point pos = new Point(e.DrawArea.Left, e.DrawArea.Bottom); if (!e.PreventOpening) { if (SplitMenu != null) { SplitMenu.Show(this, pos); } else if (SplitMenuStrip != null) { SplitMenuStrip.Width = e.DrawArea.Width; SplitMenuStrip.Show(this, pos); } } //Raise the event after the user click if (SplitClick != null) { SplitClick(this, e); } }
/// <summary> /// Raises the <see cref="E:SplitClick" /> event. /// </summary> /// <param name="e">The <see cref="SplitMenuEventArgs"/> instance containing the event data.</param> protected virtual void OnSplitClick(SplitMenuEventArgs e) { if (SplitMenuStrip != null) { if (showingDropdown) { //SplitMenuStrip.Close(); } else { SplitMenuOpening?.Invoke(this, e); if (!e.PreventOpening) { SplitMenuStrip.Width = e.DrawArea.Width; showingDropdown = true; SplitMenuStrip.Show(this, new Point(e.DrawArea.Left, e.DrawArea.Bottom)); } } } SplitClick?.Invoke(this, e); }