如何在网格WPF上的两个控件之间绘制连接线 [英] How to draw connecting lines between two controls on a grid WPF

查看:924
本文介绍了如何在网格WPF上的两个控件之间绘制连接线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在网格上创建控件(比如按钮)。我想在控件之间创建一个连接线。说你做了点击一个按钮,然后点击另一个按钮。这应该在这两个按钮之间画一条线。



有人可以帮助我或者给我一些关于如何做这个的想法吗?



提前致谢!



我的尝试:



我搜索谷歌的每个地方我都没有得到任何有用的解决方案

i am creating controls (say button) on a grid. I want to create a connecting line between controls. Say you you do Click on one button and click over another button. This should draw a line between these two buttons.

Can some one help me or give me some ideas on how to do this?

Thanks in advance!

What I have tried:

I searched every where in google i didn't get any useful solution

推荐答案

你可以使用wpf动画完成这项任务。您可以使用故事板在wpf中创建动画,也可以通过代码控制此动画和故事板。请参阅以下链接以开始使用wpf动画。



1. 使用WPF中的故事板进行动画 [ ^ ]

2. [ ^ ]

3. wpf - 从c#调用xaml中声明的故事板 - Stack Overflow [ ^ ]

4. c# - 以编程方式在WPF ControlTemplate中创建故事板 - 堆栈溢出 [ ^ ]

5. c# - 在WPF代码中创建故事板 - Stack Overflow [ ^ ]
You can accomplish this task by using wpf animations. You can create animations in wpf using storyboard and also you can control this animation and storyboard by code. refer below links to get started with wpf animations.

1. Animation using Storyboards in WPF[^]
2. [^]
3. wpf - Call a storyboard declared in xaml from c# - Stack Overflow[^]
4. c# - Programmatically creating a Storyboard in a WPF ControlTemplate - Stack Overflow[^]
5. c# - Creating Storyboard in code behind in WPF - Stack Overflow[^]


这篇关于如何在网格WPF上的两个控件之间绘制连接线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆