RenderTranform 不渲染变换 [英] RenderTranform not render transforming

查看:30
本文介绍了RenderTranform 不渲染变换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我有一个画布和一个椭圆.并调用一个方法来像这样移动 Ellipse

So I have a canvas and a Ellipse on it . And call a method to mote the Ellipse around like so

public void moveElipse1ToCoordinate(Point point)
    {
        Action action = () =>
        {
           TranslateTransform moveTo = new TranslateTransform();
            moveTo.X = point.X;  
            moveTo.Y = point.Y;
            StimulyEllipse1.RenderTransform = moveTo;
        };
        Dispatcher.BeginInvoke(action);
    }

我在 for 循环中使用这个函数.

And I use this function in a for loop .

for(int i=0 ; i<=1000; i++)
moveElipse1ToCoordinate(new Point(i,i)

X 和 Y 坐标都在 0 和 1000 之间,即画布的大小.然而,椭圆根本没有显示.

Both X and Y coordinates are constantly between 0 and 1000 , the size of the canvas . Yet the Ellipse is not shown at all .

这次通话中我遗漏了什么?

What am I missing from this call ?

推荐答案

如果你想让它流畅地移动,作为动画,你需要专门使用动画类.在循环完成之前,UI 不会更新(并且 X、Y 与画布大小相同,椭圆将出现在整个画布的下方和右侧).

If you want it to move smoothly, as an animation, you'll need to use the animation classes specifically. The UI won't update until the loop has completed (and with an X,Y of the size of the canvas, the ellipse would appear below and to the right of the total canvas).

这篇关于RenderTranform 不渲染变换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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