旋转元素会导致装饰器出现问题
我的装饰器有问题,它应该预览我的拖拽和拖拽的目的地。放下操作,
一切正常,直到我旋转装饰元素。
我的装饰器是一个矩形,其中填充了装饰元素的视觉画笔,因此如果旋转该元素,装饰器将获得正确的(已旋转的)图像。但由于矩形也必须旋转,因此图像再次旋转,这是不应该发生的。我可以以某种方式排除变换的画笔,这样它就不会再次旋转吗?或者对于我的问题还有其他解决方案吗?
谢谢
I have a problem with my adorner which is supposed to preview the destination of my drag & drop operation,
everything is working fine until i rotate the adorned element.
My adorner is a rectangle which is filled with a visual brush of the adorned element, so if the element is rotated the adorner gets the correct (already rotated) image. But because the rectangle has to be rotated too the image gets rotated once more which isn't supposed to happen. Can I somehow exclude the brush of the transformation so it will not rotate again or is there another solution for my problem?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以重写装饰器类中的 GetDesiredTransform 方法,并操作应用于装饰器子级(在您的情况下带有可视画笔的矩形)的变换。
You can override the GetDesiredTransform method in the adorner class and manipulate the transforms applied to the adorner's children (the rectangle with the visual brush in your case).
最后我有一个解决这个问题的方法:
使用这个小算法链接< /a> 我创建了 UI 元素的副本,将其 rendertransform 属性设置为 null 并将其用作 Visualbrush 而不是原始元素,这也允许我将原始元素设置为不可见!
Finally I have a solution to this problem:
with this small algorythm link I've created a copy of the UI element, set its rendertransform property to null and used it as a visualbrush instead of the original element which also allowed me to set the original element to invisible!