Exemplo n.º 1
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            switch (fMode)
            {
            case ChartControlMode.ccmDefault:
                var mAct = GetMouseAction(e, MouseEvent.meMove);

                if (mAct.Action == MouseAction.maHighlight)
                {
                    SetHighlight(mAct.Person);
                }
                else
                {
                    SetHighlight(null);

                    ITreeControl ctl = fTreeControls.Contains(e.X, e.Y);

                    if (ctl != null)
                    {
                        fMode       = ChartControlMode.ccmControlsVisible;
                        ctl.Visible = true;
                        ctl.MouseMove(e.X, e.Y);
                        fActiveControl = ctl;

                        var pt = new Point(e.X + Left, e.Y + Top);
                        fToolTip.Show(ctl.Tip, this, pt, 1500);
                    }
                }
                break;

            case ChartControlMode.ccmDragImage:
                AdjustScroll(-(e.X - fMouseX), -(e.Y - fMouseY));
                fMouseX = e.X;
                fMouseY = e.Y;
                break;

            case ChartControlMode.ccmControlsVisible:
                if (fActiveControl != null)
                {
                    if (!(fActiveControl.Contains(e.X, e.Y) || fActiveControl.MouseCaptured))
                    {
                        fMode = ChartControlMode.ccmDefault;
                        fActiveControl.Visible = false;
                        fToolTip.Hide(this);
                        fActiveControl = null;
                    }
                    else
                    {
                        fActiveControl.MouseMove(e.X, e.Y);
                    }
                }
                break;
            }

            base.OnMouseMove(e);
        }
Exemplo n.º 2
0
            public ITreeControl Contains(int x, int y)
            {
                for (int i = 0; i < Count; i++)
                {
                    ITreeControl ctl = this[i];
                    if (ctl.Contains(x, y))
                    {
                        return(ctl);
                    }
                }

                return(null);
            }
Exemplo n.º 3
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            Point scrPt = GetScrollRelativeLocation(e.Location);

            switch (fMode)
            {
            case ChartControlMode.ccmDefault:
                TreeChartPerson mPers;
                MouseAction     mAct = GetMouseAction(e, MouseEvent.meMove, out mPers);

                if (mAct == MouseAction.maHighlight)
                {
                    SetHighlight(mPers);
                }
                else
                {
                    SetHighlight(null);

                    ITreeControl ctl = fTreeControls.Contains(scrPt.X, scrPt.Y);

                    if (ctl != null)
                    {
                        fMode       = ChartControlMode.ccmControlsVisible;
                        ctl.Visible = true;
                        ctl.MouseMove(scrPt.X, scrPt.Y);
                        fActiveControl = ctl;

                        //pt = new Point(pt.X + Left, pt.Y + Top);
                        //fToolTip.Show(ctl.Tip, this, pt, 1500);
                        ToolTip = ctl.Tip;
                    }
                }
                break;

            case ChartControlMode.ccmDragImage:
                Point pt = new Point(e.Location);
                AdjustScroll(-(pt.X - fMouseX), -(pt.Y - fMouseY));
                fMouseX = pt.X;
                fMouseY = pt.Y;
                break;

            case ChartControlMode.ccmControlsVisible:
                if (fActiveControl != null)
                {
                    if (!(fActiveControl.Contains(scrPt.X, scrPt.Y) || fActiveControl.MouseCaptured))
                    {
                        fMode = ChartControlMode.ccmDefault;
                        fActiveControl.Visible = false;
                        //fToolTip.Hide(this);
                        ToolTip        = "";
                        fActiveControl = null;
                    }
                    else
                    {
                        fActiveControl.MouseMove(scrPt.X, scrPt.Y);
                    }
                }
                break;
            }

            e.Handled = true;
            base.OnMouseMove(e);
        }