/// <include file='doc\ToolStripComboButton.uex' path='docs/doc[@for="ToolStripSplitButton.OnMouseUp"]/*' /> /// <devdoc> /// Summary of OnMouseUp. /// </devdoc> protected override void OnMouseUp(MouseEventArgs e) { if (!Enabled) { return; } SplitButtonButton.Push(false); if (DropDownButtonBounds.Contains(e.Location)) { if (e.Button == MouseButtons.Left) { if (DropDown.Visible) { Debug.Assert(ParentInternal != null, "Parent is null here, not going to get accurate ID"); byte closeMouseId = (ParentInternal == null) ? (byte)0: ParentInternal.GetMouseId(); if (closeMouseId != openMouseId) { openMouseId = 0; // reset the mouse id, we should never get this value from toolstrip. ToolStripManager.ModalMenuFilter.CloseActiveDropDown(DropDown, ToolStripDropDownCloseReason.AppClicked); Select(); } } } } Point clickPoint = new Point(e.X, e.Y); if ((e.Button == MouseButtons.Left) && this.SplitButtonButton.Bounds.Contains(clickPoint)) { bool shouldFireDoubleClick = false; if (DoubleClickEnabled) { long newTime = DateTime.Now.Ticks; long deltaTicks = newTime - lastClickTime; lastClickTime = newTime; // use >= for cases where the succession of click events is so fast it's not picked up by // DateTime resolution. Debug.Assert(deltaTicks >= 0, "why are deltaticks less than zero? thats some mighty fast clicking"); // if we've seen a mouse up less than the double click time ago, we should fire. if (deltaTicks >= 0 && deltaTicks < DoubleClickTicks) { shouldFireDoubleClick = true; } } if (shouldFireDoubleClick) { OnButtonDoubleClick(new System.EventArgs()); // VSWhidbey 486983: if we actually fired DoubleClick - reset the lastClickTime. lastClickTime = 0; } else { OnButtonClick(new System.EventArgs()); } } }
protected override void OnMouseUp(MouseEventArgs e) { if ((Control.ModifierKeys != Keys.Alt) && (e.Button == MouseButtons.Left)) { Debug.Assert(ParentInternal != null, "Parent is null here, not going to get accurate ID"); byte closeMouseId = (ParentInternal == null) ? (byte)0: ParentInternal.GetMouseId(); if (closeMouseId != openMouseId) { openMouseId = 0; // reset the mouse id, we should never get this value from toolstrip. ToolStripManager.ModalMenuFilter.CloseActiveDropDown(DropDown, ToolStripDropDownCloseReason.AppClicked); Select(); } } base.OnMouseUp(e); }
/// <include file='doc\ToolStripComboButton.uex' path='docs/doc[@for="ToolStripSplitButton.OnMouseDown"]/*' /> /// <devdoc> /// Summary of OnMouseDown. /// </devdoc> protected override void OnMouseDown(MouseEventArgs e) { if (DropDownButtonBounds.Contains(e.Location)) { if (e.Button == MouseButtons.Left) { if (!DropDown.Visible) { Debug.Assert(ParentInternal != null, "Parent is null here, not going to get accurate ID"); openMouseId = (ParentInternal == null) ? (byte)0: ParentInternal.GetMouseId(); this.ShowDropDown(/*mousePress = */ true); } } } else { SplitButtonButton.Push(true); } }
/// <include file='doc\ToolStripPopupButton.uex' path='docs/doc[@for="ToolStripDropDownButton.OnMouseDown"]/*' /> /// <devdoc> /// Overriden to invoke displaying the popup. /// </devdoc> protected override void OnMouseDown(MouseEventArgs e) { if ((Control.ModifierKeys != Keys.Alt) && (e.Button == MouseButtons.Left)) { if (DropDown.Visible) { ToolStripManager.ModalMenuFilter.CloseActiveDropDown(DropDown, ToolStripDropDownCloseReason.AppClicked); } else { // opening should happen on mouse down. Debug.Assert(ParentInternal != null, "Parent is null here, not going to get accurate ID"); openMouseId = (ParentInternal == null) ? (byte)0: ParentInternal.GetMouseId(); this.ShowDropDown(/*mousePush =*/ true); } } base.OnMouseDown(e); }