Exemplo n.º 1
0
 internal virtual void OnMouseDown(ExMouseEventArgs e)
 {
     if (ShowCloseButton && CloseButtonBounds.Contains(e.X, e.Y) && e.Button == MouseButtons.Left)
     {
         Hide(true);
     }
 }
Exemplo n.º 2
0
        public override void OnMouseMove(ExMouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (NewLineFrom != null)
            {
                Point pt = PaintHelper.CenterPoint(NewLineFrom.Bounds);
                pt = View.PointToReal(pt);
                Rectangle rect = PaintHelper.GetRectangle(pt, MousePoint);
                rect = Rectangle.Union(rect, PaintHelper.GetRectangle(pt, new Point(e.X, e.Y)));

                MousePoint.X = e.X;
                MousePoint.Y = e.Y;

                InvalidateChart(rect, false);
            }
            else
            {
                // test - is drag control handle
                if (PressMouseButton == MouseButtons.Left &&
                    SelectedObject.ControlHandle != BezierPoint.None)
                {
                    DragControlHandle(SelectedObject.ControlHandle, new Point(e.X, e.Y));

                    e.Suppress = true;
                    if (View.Cursor != Cursors.SizeAll)
                    {
                        View.Cursor = Cursors.SizeAll;
                    }
                }
                else
                {
                    HoverObject = HitTest(e.X, e.Y);
                    // test - is open url
                    if (HoverObject.Link != null && Helper.TestModifierKeys(Keys.Shift) && !string.IsNullOrEmpty(HoverObject.Link.Hyperlink))
                    {
                        e.Suppress = true;
                        if (View.Cursor != Cursors.Hand)
                        {
                            View.Cursor = Cursors.Hand;
                        }
                    }
                    else if (HoverObject.ControlHandle != BezierPoint.None)
                    {
                        if (View.Cursor != Cursors.SizeAll)
                        {
                            View.Cursor = Cursors.SizeAll;
                        }
                        e.Suppress = true;
                    }
                    //else
                    //View.Cursor = Cursors.Default;
                }
            }
        }
Exemplo n.º 3
0
        public override void OnMouseUp(ExMouseEventArgs e)
        {
            base.OnMouseUp(e);

            foreach (ChartToolTip tooltip in ToolTips)
            {
                if (tooltip.Visible && tooltip.Bounds.Contains(e.X, e.Y))
                {
                    tooltip.OnMouseUp(e);
                    e.Suppress = true;
                }
            }
        }
Exemplo n.º 4
0
        internal override void OnMouseUp(ExMouseEventArgs e)
        {
            base.OnMouseUp(e);

            if (HyperlinkBounds != null && Hyperlinks != null && HyperlinkBounds.Length == Hyperlinks.Length)
            {
                for (int i = 0; i < HyperlinkBounds.Length; i++)
                {
                    if (HyperlinkBounds[i].Contains(e.X, e.Y))
                    {
                        Helper.OpenUrl(Hyperlinks[i]);
                        return;
                    }
                }
            }
        }
Exemplo n.º 5
0
        internal override void OnMouseMove(ExMouseEventArgs e)
        {
            base.OnMouseMove(e);

            if (HyperlinkBounds != null)
            {
                for (int i = 0; i < HyperlinkBounds.Length; i++)
                {
                    if (HyperlinkBounds[i].Contains(e.X, e.Y))
                    {
                        Parent.Owner.Cursor = Cursors.Hand;
                        return;
                    }
                }

                Parent.Owner.Cursor = Cursors.Default;
            }
        }
Exemplo n.º 6
0
        void EndNewLineTest(ExMouseEventArgs e)
        {
            Point pt    = new Point(e.X - View.TranslatePoint.X, e.Y - View.TranslatePoint.Y);
            Topic topic = View.GetTopicAt(e.X, e.Y);

            if (topic != null && topic != NewLineFrom)
            {
                Link link = Link.CreateNew(NewLineFrom, topic);
                if (link != null)
                {
                    link.RefreshLayout();
                    View.Select(link);
                    SelectedObject = new HitTestResult(link, BezierPoint.None);
                }
            }

            NewLineFrom = null;
        }
Exemplo n.º 7
0
        public override void OnMouseDown(ExMouseEventArgs e)
        {
            base.OnMouseDown(e);

            PressMouseButton = e.Button;
            PressedObject    = HitTest(e.X, e.Y);
            if (e.Button == MouseButtons.Left && PressedObject.Link != null && Helper.TestModifierKeys(Keys.Shift))
            {
                e.Suppress = true;
            }
            else
            {
                SelectedObject = HitTest(e.X, e.Y);

                DragingControlHandle = BezierPoint.None;
                if (!SelectedObject.IsEmpty || NewLineFrom != null)
                {
                    e.Suppress = true;
                }
            }
        }
Exemplo n.º 8
0
 internal virtual void OnMouseUp(ExMouseEventArgs e)
 {
     Hide(false);
 }
Exemplo n.º 9
0
 internal virtual void OnMouseMove(ExMouseEventArgs e)
 {
     IsMouseHover = true;
 }
Exemplo n.º 10
0
        public override void OnMouseUp(ExMouseEventArgs e)
        {
            base.OnMouseUp(e);

            PressMouseButton = MouseButtons.None;
            //MouseDownObject = HitTestResult.Empty;

            if (NewLineFrom != null)
            {
                EndNewLineTest(e);
                e.Suppress = true;
            }
            else if (e.Button == MouseButtons.Left && PressedObject.Link != null && Helper.TestModifierKeys(Keys.Shift))
            {
                if (!string.IsNullOrEmpty(PressedObject.Link.Hyperlink))
                {
                    Helper.OpenUrl(PressedObject.Link.Hyperlink);
                }
            }
            else
            {
                if (DragingControlHandle != BezierPoint.None && TempLayout != null && SelectedObject.Link != null)
                {
                    Link line      = SelectedObject.Link;
                    var  oldPoints = line.GetBezierPoints();
                    //Rectangle rect = line.Bounds;

                    Point pt = View.PointToLogic(new Point(e.X, e.Y));
                    Point pts;
                    Topic topic;
                    switch (DragingControlHandle)
                    {
                    case BezierPoint.StartPoint:
                        topic = View.GetTopicAt(e.X, e.Y);
                        if (line.CanStartFrom(topic))
                        {
                            line.From = topic;
                        }
                        break;

                    case BezierPoint.EndPoint:
                        topic = View.GetTopicAt(e.X, e.Y);
                        if (line.CanEndTo(topic))
                        {
                            line.Target = topic;
                        }
                        break;

                    case BezierPoint.ControlPoint1:
                        pts = PaintHelper.CenterPoint(line.LayoutData.StartBounds);
                        //line.LayoutData.CPLength1 = PaintHelper.GetDistance(pts, pt);
                        //line.LayoutData.CPAngle1 = PaintHelper.GetAngle(pts, pt);
                        line.LayoutData.CP1 = new BezierControlPoint(PaintHelper.GetAngle(pts, pt), PaintHelper.GetDistance(pts, pt));
                        break;

                    case BezierPoint.ControlPoint2:
                        pts = PaintHelper.CenterPoint(line.LayoutData.EndBounds);
                        //line.LayoutData.CPLength2 = PaintHelper.GetDistance(pts, pt);
                        //line.LayoutData.CPAngle2 = PaintHelper.GetAngle(pts, pt);
                        line.LayoutData.CP2 = new BezierControlPoint(PaintHelper.GetAngle(pts, pt), PaintHelper.GetDistance(pts, pt));
                        break;
                    }

                    line.RefreshLayout();
                    line.SetChanged();
                    TempLayout = line.LayoutData.Clone();

                    InvalidateLink(oldPoints, line.Width, true);
                    InvalidateLink(line, false);
                    //InvalidateLinkRegion(oldPoints, line.GetBezierPoints(), line.LineWidth);

                    /*if (rect.IsEmpty)
                     *  rect = line.Bounds;
                     * else
                     *  rect = Rectangle.Union(rect, line.Bounds);
                     * rect.Location = View.PointToReal(rect.Location);
                     * InvalidateChart(rect, true);*/
                }

                DragingControlHandle = BezierPoint.None;
            }
        }