// Capture the mouse event and hit test the coordinate point value against // the child visual objects. void MouseLeftButtonDownHandler(object sender, System.Windows.Input.MouseButtonEventArgs e) { ToolTipController.Hide(); // Retreive the coordinates of the mouse button event. Point pt = e.GetPosition(this); DrawingVisual hit = VisualTreeHelper.HitTest(this, pt).VisualHit as DrawingVisual; if (hit != null) { string tag = hit.ReadLocalValue(FrameworkElement.TagProperty) as string; if (tag != null) { foreach (DrawingVisual v in _graph.Children) { v.BitmapEffect = null; } OuterGlowBitmapEffect glow = new OuterGlowBitmapEffect(); glow.GlowColor = Colors.Blue; glow.GlowSize = 1; glow.Opacity = 0.8; glow.Freeze(); hit.BitmapEffect = glow; } } }
// Capture the mouse event and hit test the coordinate point value against // the child visual objects. void MouseLeftButtonDownHandler(object sender, System.Windows.Input.MouseButtonEventArgs e) { ToolTipController.Hide(); // Retreive the coordinates of the mouse button event. Point pt = e.GetPosition(this); DrawingVisual hit = VisualTreeHelper.HitTest(this, pt).VisualHit as DrawingVisual; if (hit != null) { string tag = hit.ReadLocalValue(FrameworkElement.TagProperty) as string; if (tag != null) { // TODO : check if double click --> if yes --> check if end of run --> if yes --> select all of the nodes if (Keyboard.IsKeyDown(Key.RightCtrl) || Keyboard.IsKeyDown(Key.LeftCtrl)) { selectedNodes.Add(tag); } else { selectedNodes.RemoveRange(0, selectedNodes.Count); selectedNodes.Add(tag); foreach (DrawingVisual v in _graph.Children) { v.BitmapEffect = null; } } SetGlowOnDrawingVisual(hit, Colors.DarkRed); if (e.ClickCount >= 2) { MouseDoubleClickOnGraphElement(this, new MouseDoubleClickEventArgs() { Node = tag }); // TODO : az értesítés, hogy dupla klikk volt és hol --> itt lesz event, ami elsütõdik és a DotViewer feliratkozott rá // TODO : A DotViewerben is lesz egy esemény amit az elõzõ eventkezelõ elsüt. Erre iratkozik fel a MainWindow // TODO : A MainWindow-ból már minden elintézhetõ --> FONTOS: a kijeölt node száma fel kell hogy szivárogjon innen } } } }
protected override void OnMouseMove(MouseEventArgs e) { Point pt = e.GetPosition(this); HitTestResult result = VisualTreeHelper.HitTest(this, pt); if (result == null) { ToolTipController.Move(null, null); } else { DrawingVisual hit = result.VisualHit as DrawingVisual; object tag = (hit != null) ? hit.ReadLocalValue(FrameworkElement.TagProperty) : null; ToolTipController.Move(ToolTipContentProvider, tag); } }