拖动以重新调整控件的大小。 [英] Drag to re-size a control.

查看:70
本文介绍了拖动以重新调整控件的大小。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个项目,我有一个网格,其中有很多行代表15个时隙。可以添加更多时隙,并且以15分钟为间隔的持续时间指定控件应跨越多少行。我想把控件拿到一个点
,我可以拖动它来重新调整它的大小但是可以捕捉更多的网格跨度。因此,在持续时间内增加15分钟。我现在可以拖动控件并将其移动到不同的时间段,它会卡入到位。我已经看到了re-sizeable网格分裂器
这是我想要的行为,但不适合这种情况。


如果有人对如何抓住顶部有任何想法或控件的底部边框然后重新调整更多行跨度我会非常感激。



问候,


比利

解决方案

嗨比利,


根据你的描述,你想拖动和调整控件大小,我认为Adorner可能对你有所帮助,关于Arorner的详细信息,你可以参考以下文章:


https://docs.microsoft.com/en-us/dotnet/framework/wpf/controls/adorners-overview


Adorner在AdornerLayer中呈现,AdornerLayer是一个始终位于装饰元素或装饰元素集合之上的渲染表面。将功能句柄添加到启用了a的UIElement用户到m以某种方式对元素进行处理(调整大小,
旋转,重新定位等)。



最好的问候,


Cherry



I currently have a project which I have a grid with many rows representing a 15 time slot. More time slots can be added and the duration in 15 minute intervals specifies how many rows the control should span over. I would like to get the control to a point where I can drag it to re-size it but to snap over more grid spans. Therefore adding 15 minutes to the duration. I can currently drag the control around and move it to different time slots and it snaps into place. I have seen the re-sizeable grid spliters which is the behaviour I would like but does not fit this scenario.

If anyone has any ideas on how I could grab the top or bottom borders of the control to then re-size over more row spans I would be very thankful.

Regards,

Billy

解决方案

Hi Billy,

According to your description, you want to drag and resize control , I think the Adorner may be helpful to you, about Arorner detailed info, you can take the following article:

https://docs.microsoft.com/en-us/dotnet/framework/wpf/controls/adorners-overview

Adorners are rendered in an AdornerLayer, which is a rendering surface that is always on top of the adorned element or a collection of adorned elements.Adding functional handles to a UIElement that enable a user to manipulate the element in some way (resize, rotate, reposition, etc.).

Best Regards,

Cherry


这篇关于拖动以重新调整控件的大小。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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