Ejemplo n.º 1
0
        private void Control_MouseClick(object sender, MouseEventArgs e)
        {
            if (IsSupsended || Disposed)
            {
                return;
            }

            #region Panel
            if (HittedPanel != null)
            {
                HittedPanel.OnClick(e);
            }
            #endregion

            #region Item

            if (HittedItem != null)
            {
                HittedItem.OnClick(e);
            }

            #endregion

            #region SubItem

            if (HittedSubItem != null)
            {
                HittedSubItem.OnClick(e);
            }

            #endregion
        }
Ejemplo n.º 2
0
        private void Control_MouseClick(object sender, MouseEventArgs e)
        {
            if (IsSupsended || Disposed)
            {
                return;
            }

            #region Panel

            if (HittedPanel != null)
            {
                HittedPanel.OnClick(e);
            }

            #endregion

            #region Item

            //Kevin Carbis - Added _lastMouseDown variable to track if our click originated with this control.
            //Sometimes when scrolling your mouse moves off the thumb while dragging and your mouseup event
            //is not the same control that you started with.  This omits firing the click event on the control you
            //eventually release the mouse over if it wasn't the control you started with.
            if (HittedItem != null && HittedItem == _lastMouseDown)
            {
                //Kevin Carbis - this fixes the focus problem with textboxes when a different item is clicked
                //and the edit box is still visible. This will now close the edit box for the textbox that previously
                //had the focus. Otherwise the first click on a button would close the textbox and you would have to click twice.
                //Control.Focus();
                if (_ribbon.ActiveTextBox != null)
                {
                    (_ribbon.ActiveTextBox as RibbonTextBox).EndEdit();
                }

                //foreach (RibbonPanel pnl in HittedItem.OwnerTab.Panels)
                //{
                //   foreach (RibbonItem itm in pnl.Items)
                //   {
                //      if (itm is RibbonTextBox && itm != HittedItem)
                //      {
                //         RibbonTextBox txt = (RibbonTextBox)itm;
                //         txt.EndEdit();
                //      }
                //   }
                //}

                HittedItem.OnClick(e);
            }

            #endregion

            #region SubItem

            if (HittedSubItem != null)
            {
                HittedSubItem.OnClick(e);
            }

            #endregion
        }