Exemplo n.º 1
0
        protected override void OnMouseDown(MouseEventArgs e)
        {
            base.OnMouseDown(e);
            isMouseDown = base.Bounds.Contains(e.Location);

            for (int i = listChildControls.Count - 1; i >= 0; i--)
            {
                WLControlBase ctl = listChildControls[i];
                if (!ctl.Visible)
                    continue;
                if (ctl.Bounds.Contains(e.Location))
                {
                    if (ctl.Enabled)
                    {
                        capturedControl = ctl;
                        ctl.MouseOperation(e, MouseOperationType.Down);
                    }
                    break;
                }
            }
        }
Exemplo n.º 2
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
            if (isMouseDown)
            {
                if (capturedControl != null)
                    capturedControl.MouseOperation(e, MouseOperationType.Move);
            }
            else
            {
                for (int i = listChildControls.Count - 1; i >= 0; i--)
                {
                    WLControlBase ctl = listChildControls[i];

                    if (!ctl.Visible)
                        continue;

                    if (ctl.Bounds.Contains(e.Location))
                    {
                        if (lastMouseMoveControl != null && lastMouseMoveControl != ctl)
                            lastMouseMoveControl.MouseOperation(Point.Empty, MouseOperationType.Leave);
                        ctl.MouseOperation(e, MouseOperationType.Move);
                        lastMouseMoveControl = ctl;
                        return;
                    }
                }
                if (lastMouseMoveControl != null)
                    lastMouseMoveControl.MouseOperation(Point.Empty, MouseOperationType.Leave);
                lastMouseMoveControl = null;
            }
        }
Exemplo n.º 3
0
 protected override void OnMouseLeave(MouseEventArgs e)
 {
     base.OnMouseLeave(e);
     if (lastMouseMoveControl != null)
         lastMouseMoveControl.MouseOperation(Point.Empty, MouseOperationType.Leave);
     lastMouseMoveControl = null;
     isMouseDown = false;
 }
Exemplo n.º 4
0
 protected override void OnMouseUp(MouseEventArgs e)
 {
     base.OnMouseUp(e);
     if (capturedControl != null)
         capturedControl.MouseOperation(e, MouseOperationType.Up);
     capturedControl = null;
     isMouseDown = false;
 }