如何在画布中拖动元素时添加智能参考线 [英] How to add Smart Guides in while drag an element in the canvas

查看:239
本文介绍了如何在画布中拖动元素时添加智能参考线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello all


我使用以下代码


https://www.codeproject.com/Articles/24681/ WPF-Diagram-Designer-Part



我想为所有控件实现智能指南


与功率点相同


http://www.indezine.com/products/powerpoint/learn/powerpoint-2013/smarter-guides-ppt2013.html



任何人都可以指导我





-


Sharath kumar




sharathkumar11

解决方案

您拥有的每个ui对象都有边界。


如果您将ui元素的背景设为画布,则可以在画布上定位,但很可能会发生奇怪的事情。


visual studio在设计器中调整大小句柄的方式是在adorner layer。


这取决于一切(但在窗口内)。


它允许你把东西放在通常的东西之外你的ui对象的边界和相对它的边界。


你可以做任何你想要的线条和椭圆。


理论上这一切都非常好但是装饰工具是非常棘手的事情。


你会发现大多数样本都在代码中定义了一些简单的东西,瞧你在这里完成。


您会发现其他样品有严重的局限性。撰写博客的人已经完成了部分工作,要么放弃解决问题,要么只是尝试做一些非常简单的事情。


我推荐这个系列:


http://www.nbdtech.com/Blog/archive/2010/06/21/wpf-adorners-part-1-ndash-what-are-adorners.aspx


不要只停留在那个页面上,有更多的负载。


只是一行不应该太难。



Hello all

I am using the following code

https://www.codeproject.com/Articles/24681/WPF-Diagram-Designer-Part

i want to implement smart guides for all the controls

same like power point

http://www.indezine.com/products/powerpoint/learn/powerpoint-2013/smarter-guides-ppt2013.html

Can any one guide me 



--

Sharath kumar


sharathkumar11

解决方案

Each ui object you have has a boundary.

If you make the background of your ui element a canvas you can position off the canvas but strange things are likely to happen.

The way visual studio does the resizing handles in the designer is to add elements in the adorner layer.

That goes on top of everything ( but inside the window ).

It allows you to position stuff outside what would usually be the boundary of your ui object and relative to it.

You could do lines and ellipses, anything you want.

Which is all very well in theory but adorners are pretty tricky things to work with.

You will find most samples define something simple in code, and voila here you go... done.

You will find other samples have serious limitations. The person writing the blog got part way through and either gave up resolving the issues or was only trying to do something pretty simple.

I recommend this series:

http://www.nbdtech.com/Blog/archive/2010/06/21/wpf-adorners-part-1-ndash-what-are-adorners.aspx

Don't just stop at that page, there's a load more.

Just a line shouldn't be too hard.


这篇关于如何在画布中拖动元素时添加智能参考线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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