本文介绍了自定义可拖动对象从窗口移开并旋转怪异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
嘿,
我有定制的可拖动对象,它们可以滑动拖放和旋转我无法将对象从窗口滑出,是否可以通过某种方式创建边界以将这些对象保持在窗口上?我还有一个问题,即由于空白/Canvas.left ="79",对象旋转太多.有任何想法吗?
这是其中一个对象的样本(这是一块拼图)
Hey,
I have custom made draggable objects that can slide drag / drop and rotate I am have trouble with the objects sliding off the window is there some way I can create a boundary to keep these objects on the window? Also I have an issue where the objects rotate too much because of the margin / Canvas.left ="79" any ideas?
here is a sample of one of the objects (it's a puzzle piece)
<mt:DraggableObjectBorder x:Name="dragborder1" IsTossable="True" CanRotate="True" CanSize="False" CanMove="True" Width="292.5" Height="387.5" Canvas.Left="79" Canvas.Top="95">
<mt:DraggableObjectBorder.Clip>
<PathGeometry Figures="M292,268c4-24,3-47-6-69c-24-2-47,7-71,1c-28-7-50-26-58-50c-13-41,37-81,79-67c18,6,24,29,41,39c6,4,10-4,10-8
c0.6-37.784,3.351-76.287,0.5-114H0v302.767C43.442,290.788,87.721,281.405,132,288c12,20-16,29-23,44s-8,38,9,47c31,16,84,0,76-40
c-3-17-28-32-21-53c37.363-1.384,74.512-0.64,111.646,0.171c0.125-1.391,0.245-2.781,0.354-4.171C286,278,291,273,292,268z"/>
</mt:DraggableObjectBorder.Clip>
<Grid>
<Ellipse x:Name="Piece1Right" Fill="Yellow" StrokeThickness="2" Margin="145,-105,0,0" Width="125" Height="120" />
<Ellipse x:Name="Piece1Bottum" Fill="Yellow" StrokeThickness="2" Margin="5,315,0,0" Width="30" Height="30" />
<Image x:Name="piece1" Width="866" Height="577" Stretch="Fill" ClipToBounds="False" SnapsToDevicePixels="False" Source="C:\Users\Public\image1.jpg" >
<Image.Clip>
<PathGeometry Figures="M292,268c4-24,3-47-6-69c-24-2-47,7-71,1c-28-7-50-26-58-50c-13-41,37-81,79-67c18,6,24,29,41,39c6,4,10-4,10-8
c0.6-37.784,3.351-76.287,0.5-114H0v302.767C43.442,290.788,87.721,281.405,132,288c12,20-16,29-23,44s-8,38,9,47c31,16,84,0,76-40
c-3-17-28-32-21-53c37.363-1.384,74.512-0.64,111.646,0.171c0.125-1.391,0.245-2.781,0.354-4.171C286,278,291,273,292,268z"/>
</Image.Clip>
</Image>
</Grid>
</mt:DraggableObjectBorder>
谢谢,
Bahearn
Thanks,
Bahearn
推荐答案
这篇关于自定义可拖动对象从窗口移开并旋转怪异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!