Ejemplo n.º 1
0
            public void Draw(int dataIndex, Point cursorPos)
            {
                if (_isVisible && ReplicateIndex != dataIndex)
                {
                    Hide();
                }
                if (_isVisible && ReplicateIndex == dataIndex)
                {
                    return;
                }
                if (_table == null || _table.Count == 0)
                {
                    return;
                }

                ReplicateIndex = dataIndex;
                var basePoint = new UserPoint(dataIndex + 1,
                                              _parent.GetDataSeries()[ReplicateIndex] / _parent.YScale, _parent);

                using (var g = _parent.GraphSummary.GraphControl.CreateGraphics())
                {
                    var size   = _table.CalcDimensions(g);
                    var offset = new Size(0, -(int)(size.Height + size.Height / _table.Count));
                    if (_tip == null)
                    {
                        _tip = new NodeTip(_parent);
                    }
                    _tip.SetTipProvider(TipProvider, new Rectangle(basePoint.Screen(offset), new Size()), cursorPos);
                }
                _isVisible = true;
            }
Ejemplo n.º 2
0
        public bool MoveMouse(MouseButtons buttons, Point point)
        {
            // Pan
            if (ModifierKeys.HasFlag(Keys.Control) && buttons.HasFlag(MouseButtons.Left))
            {
                AdjustLocations(zedGraphControl.GraphPane);
            }

            CurveItem nearestCurveItem = null;
            var       index            = -1;

            if (TryGetNearestCurveItem(point, ref nearestCurveItem, ref index))
            {
                var lineItem = nearestCurveItem as LineItem;
                if (lineItem == null || index < 0 || index >= lineItem.Points.Count || lineItem[index].Tag == null)
                {
                    return(false);
                }

                _selectedRow           = (FoldChangeBindingSource.FoldChangeRow)lineItem[index].Tag;
                zedGraphControl.Cursor = Cursors.Hand;

                if (_tip == null)
                {
                    _tip = new NodeTip(this)
                    {
                        Parent = ParentForm
                    }
                }
                ;

                _tip.SetTipProvider(new FoldChangeRowTipProvider(_selectedRow), new Rectangle(point, new Size()),
                                    point);

                return(true);
            }
            else
            {
                if (_tip != null)
                {
                    _tip.HideTip();
                }

                _selectedRow = null;
                return(false);
            }
        }
Ejemplo n.º 3
0
        private void pickListMulti_MouseMove(object sender, MouseEventArgs e)
        {
            Point pt = e.Location;

            if (!_moveThreshold.Moved(pt))
            {
                return;
            }
            _moveThreshold.Location = null;

            ITipProvider tipProvider = null;
            int          i           = GetIndexAtPoint(pt);

            // Make sure it is in the text portion of the item
            if (i != -1 && !GetItemTextRectangle(i).Contains(pt))
            {
                i = -1;
            }

            if (i == -1)
            {
                _lastTipNode     = null;
                _lastTipProvider = null;
            }
            else
            {
                var nodeDoc = GetVisibleChoice(i).Choice;
                if (!ReferenceEquals(nodeDoc, _lastTipNode))
                {
                    _lastTipNode     = nodeDoc;
                    _lastTipProvider = _picker.GetPickTip(nodeDoc);
                }
                tipProvider = _lastTipProvider;
            }

            if (tipProvider == null || !tipProvider.HasTip)
            {
                _nodeTip.HideTip();
            }
            else
            {
                _nodeTip.SetTipProvider(tipProvider, GetItemTextRectangle(i), pt);
            }
        }