Пример #1
0
        void gViewer_ObjectUnderMouseCursorChanged(object sender, ObjectUnderMouseCursorChangedEventArgs e) {
            selectedObject = e.OldObject != null ? e.OldObject.DrawingObject : null;

            if (selectedObject != null) {
                if (selectedObject is Edge)
                    (selectedObject as Edge).Attr = selectedObjectAttr as EdgeAttr;
                else if (selectedObject is Node)
                    (selectedObject as Node).Attr = selectedObjectAttr as NodeAttr;

                selectedObject = null;
            }

            if (gViewer.SelectedObject == null) {
                label1.Text = "No object under the mouse";
                this.gViewer.SetToolTip(toolTip1, "");

            } else {
                selectedObject = gViewer.SelectedObject;
                Edge edge = selectedObject as Edge;
                if (edge != null) {
                    selectedObjectAttr = edge.Attr.Clone();
                    edge.Attr.Color = Microsoft.Msagl.Drawing.Color.Magenta;

                    //here we can use e.Attr.Id or e.UserData to get back to the user data
                    this.gViewer.SetToolTip(this.toolTip1, String.Format("edge from {0} {1}", edge.Source, edge.Target));

                } else if (selectedObject is Node) {

                    selectedObjectAttr = (gViewer.SelectedObject as Node).Attr.Clone();
                    (selectedObject as Node).Attr.Color = Microsoft.Msagl.Drawing.Color.Magenta;
                    //here you can use e.Attr.Id to get back to your data
                    this.gViewer.SetToolTip(toolTip1, String.Format("node {0}", (selectedObject as Node).Attr.Id));
                }
                label1.Text = selectedObject.ToString();
            }
            gViewer.Invalidate();
        }
Пример #2
0
 void GvObjectUnderMouseCursorChanged(object sender, ObjectUnderMouseCursorChangedEventArgs e) {
     SetStatusText();
 }
Пример #3
0
 void viewer_ObjectUnderMouseCursorChanged(object sender, Microsoft.Msagl.Drawing.ObjectUnderMouseCursorChangedEventArgs e)
 {
 }
 void graphViewer_ObjectUnderMouseCursorChanged(object sender, ObjectUnderMouseCursorChangedEventArgs e)
 {
     var node = graphViewer.ObjectUnderMouseCursor as IViewerNode;
     if (node != null) {
         var drawingNode = (Node) node.DrawingObject;
         statusTextBox.Text = drawingNode.Label.Text;
     }
     else {
         var edge = graphViewer.ObjectUnderMouseCursor as IViewerEdge;
         if (edge != null)
             statusTextBox.Text = ((Edge) edge.DrawingObject).SourceNode.Label.Text + "->" +
                                  ((Edge) edge.DrawingObject).TargetNode.Label.Text;
         else
             statusTextBox.Text = "No object";
     }
 }
Пример #5
0
 void ViewerObjectUnderMouseCursorChanged(object sender, ObjectUnderMouseCursorChangedEventArgs e) {
     if (TargetPort != null) {
         viewer.RemoveTargetPortEdgeRouting();
         TargetPort = null;
     }
 }
Пример #6
0
        void UnconditionalHit(MouseEventArgs args, EntityFilterDelegate filter)
        {
            System.Drawing.Point point = args != null
                                             ? new System.Drawing.Point(args.X, args.Y)
                                             : DrawingPanel.PointToClient(MousePosition);

            object old = selectedDObject;
            if (bBNode == null && DGraph != null)
                bBNode = DGraph.BBNode;
            if (bBNode != null) {
                Geometry geometry = bBNode.Hit(ScreenToSource(point), GetHitSlack(), filter);

                selectedDObject = geometry == null ? null : geometry.dObject;

                if (old != selectedDObject) {
                    SetSelectedObject(selectedDObject);
                    if (ObjectUnderMouseCursorChanged != null) {
                        var changedArgs = new ObjectUnderMouseCursorChangedEventArgs((IViewerObject) old,
                                                                                     selectedDObject);
                        ObjectUnderMouseCursorChanged(this, changedArgs);
                    }
                }
            }
        }
        static void DisplayGeometryGraph_ObjectUnderMouseCursorChanged(object sender, ObjectUnderMouseCursorChangedEventArgs e) {
            var gv = (GViewer)sender;
            Form form = (Form) gv.Parent;
            System.Windows.Forms.Label label = null;
            foreach (var l in form.Controls) {
                label = l as System.Windows.Forms.Label;
                if (label != null)
                    break;
            }

            var selObj = gv.SelectedObject;
            if (selObj == null)
                label.Text = "no object";
            else
                label.Text = selObj.ToString();
            
        }
Пример #8
0
 /// <summary>
 /// Event handler for when the mouse cursor changes.
 /// </summary>
 /// <param name="sender">Sender</param>
 /// <param name="e">ObjectUnderMouseCursorChangedEventArgs</param>
 void ViewerObjectUnderMouseCursorChanged(object sender,
     ObjectUnderMouseCursorChangedEventArgs e)
 {
 }
Пример #9
0
 void GViewerObjectUnderMouseCursorChanged(object sender, ObjectUnderMouseCursorChangedEventArgs e) {
     IViewerObject underCursor = gViewer.ObjectUnderMouseCursor;
     object sel = underCursor == null ? null : underCursor.DrawingObject;
     if (sel is Node) {
         var n = sel as Node;
         selection.Text = n.Id;
     }
     else if (sel is Edge) {
         var edge = sel as Edge;
         selection.Text = edge.Source + "->" + edge.Target;
     }
     else
         selection.Text = "";
 }
Пример #10
0
        void GViewerObjectUnderMouseCursorChanged(object sender, ObjectUnderMouseCursorChangedEventArgs e)
        {
            selectedObject = e.OldObject != null ? e.OldObject.DrawingObject : null;

            if (selectedObject != null) {
                RestoreSelectedObjAttr();
                gViewer.Invalidate(e.OldObject);
                selectedObject = null;
            }

            if (gViewer.SelectedObject == null) {
                label1.Text = "No object under the mouse";
                gViewer.SetToolTip(toolTip1, "");
            } else {
                selectedObject = gViewer.SelectedObject;
                var edge = selectedObject as Edge;
                if (edge != null) {
                    selectedObjectAttr = edge.Attr.Clone();
                   edge.Attr.Color = Color.Blue;
                    gViewer.Invalidate(e.NewObject);

               //         here we can use e.Attr.Id or e.UserData to get back to the user data
                    gViewer.SetToolTip(toolTip1, String.Format("edge from {0} to {1}", edge.Source, edge.Target));
                } else if (selectedObject is Microsoft.Msagl.Drawing.Node) {
                    selectedObjectAttr = (gViewer.SelectedObject as Microsoft.Msagl.Drawing.Node).Attr.Clone();
                    (selectedObject as Microsoft.Msagl.Drawing.Node).Attr.Color = Color.Green;
                 // //   here you can use e.Attr.Id to get back to your data
                    gViewer.SetToolTip(toolTip1,
                                       String.Format("node {0}",
                                                     (selectedObject as Microsoft.Msagl.Drawing.Node).Attr.Id));
                    gViewer.Invalidate(e.NewObject);
                }
                label1.Text = selectedObject.ToString();
            }
        }