wpf自定义控件:另一个矩形内的可拖动/可调整大小的矩形

时间:2021-08-17 14:17:28

I'm working on a c# wpf app. I'm looking into a control with two rectangles: one inside the other. I want the user to be able to drag the inner rectangle, resize it and if possible rotate it as well within the bounds of the outer rectangle. The values should be bindable so I can store the values in my datasource when updated.

我正在研究一个c#wpf应用程序。我正在寻找一个带有两个矩形的控件:一个在另一个里面。我希望用户能够拖动内部矩形,调整其大小,如果可能的话,也可以在外部矩形的边界内旋转它。这些值应该是可绑定的,因此我可以在更新时将值存储在我的数据源中。

Are there already controls like this or does anyone have any suggestions?

是否已经有这样的控件或有没有人有任何建议?

I saw a codeproject article on dragging elements in a canvas but those properties aren't bindable..

我看到一篇关于在画布中拖动元素的代码项目文章,但这些属性不可绑定。

Thanks,

谢谢,

2 个解决方案

#1


18  

This guy on CodeProject has a series of articles that do exactly what I think you're looking for. I expect the first article will be of most help to you, but the entire series is good.

这个关于CodeProject的人有一系列文章正是我认为你正在寻找的。我希望第一篇文章对你有所帮助,但整个系列都很好。

1. Drag, resize, and rotate elements on a canvas

1.在画布上拖动,调整大小和旋转元素

2. Designer Canvas with Zoombox

2.带有Zoombox的Designer Canvas

3. Connecting Items

3.连接物品

4. A frankenbuild

弗兰肯建筑

#2


1  

This : Codeproject is something quite similar. If you can't find anything that suits you more then it is in my opinion a good base to start.

这:Codeproject非常相似。如果你找不到更适合你的东西,那么我认为这是一个很好的基础。

#1


18  

This guy on CodeProject has a series of articles that do exactly what I think you're looking for. I expect the first article will be of most help to you, but the entire series is good.

这个关于CodeProject的人有一系列文章正是我认为你正在寻找的。我希望第一篇文章对你有所帮助,但整个系列都很好。

1. Drag, resize, and rotate elements on a canvas

1.在画布上拖动,调整大小和旋转元素

2. Designer Canvas with Zoombox

2.带有Zoombox的Designer Canvas

3. Connecting Items

3.连接物品

4. A frankenbuild

弗兰肯建筑

#2


1  

This : Codeproject is something quite similar. If you can't find anything that suits you more then it is in my opinion a good base to start.

这:Codeproject非常相似。如果你找不到更适合你的东西,那么我认为这是一个很好的基础。