Example #1
0
        /// <summary>
        /// Handles the MouseDown on the control
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Control_MouseDown(object sender, MouseEventArgs e)
        {
            if (IsSupsended || Disposed)
            {
                return;
            }

            HitTest(e.Location);
            _lastMouseDown = HittedItem;

            #region Tab Scrolls
            if (HittedTab != null)
            {
                if (HittedTabScrollLeft)
                {
                    HittedTab.SetScrollLeftPressed(true);
                    Control.Invalidate(HittedTab.ScrollLeftBounds);
                }

                if (HittedTabScrollRight)
                {
                    HittedTab.SetScrollRightPressed(true);
                    Control.Invalidate(HittedTab.ScrollRightBounds);
                }
            }
            #endregion

            #region Panel
            if (HittedPanel != null)
            {
                HittedPanel.SetPressed(true);
                HittedPanel.OnMouseDown(e);
                Control.Invalidate(HittedPanel.Bounds);
            }
            #endregion

            #region Item

            if (HittedItem != null)
            {
                HittedItem.SetPressed(true);
                HittedItem.OnMouseDown(e);
                Control.Invalidate(HittedItem.Bounds);
            }

            #endregion

            #region SubItem

            if (HittedSubItem != null)
            {
                HittedSubItem.SetPressed(true);
                HittedSubItem.OnMouseDown(e);
                Control.Invalidate(Rectangle.Intersect(HittedItem.Bounds, HittedSubItem.Bounds));
            }

            #endregion
        }
        /// <summary>
        ///     Handles the MouseUp event on the control
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Control_MouseUp(object sender, MouseEventArgs e)
        {
            if (IsSupsended || Disposed)
            {
                return;
            }

            #region Tab Scrolls

            if (HittedTab != null)
            {
                if (HittedTab.ScrollLeftVisible)
                {
                    HittedTab.SetScrollLeftPressed(false);
                    Control.Invalidate(HittedTab.ScrollLeftBounds);
                }
                if (HittedTab.ScrollRightVisible)
                {
                    HittedTab.SetScrollRightPressed(false);
                    Control.Invalidate(HittedTab.ScrollRightBounds);
                }
            }

            #endregion

            #region Panel

            if (HittedPanel != null)
            {
                HittedPanel.SetPressed(false);
                HittedPanel.OnMouseUp(e);
                Control.Invalidate(HittedPanel.Bounds);
            }

            #endregion

            #region Item

            if (HittedItem != null)
            {
                HittedItem.SetPressed(false);
                HittedItem.OnMouseUp(e);
                Control.Invalidate(HittedItem.Bounds);
            }

            #endregion

            #region SubItem

            if (HittedSubItem != null)
            {
                HittedSubItem.SetPressed(false);
                HittedSubItem.OnMouseUp(e);
                Control.Invalidate(Rectangle.Intersect(HittedItem.Bounds, HittedSubItem.Bounds));
            }

            #endregion
        }