简体   繁体   English

如何在wp7的子线程中绘制许多多边形和折线

[英]How to draw many polygons and polylines in sub thread in wp7

I am developing a Windows Phone App which needs draw a lot of polygons and polylines in runtime. 我正在开发Windows Phone应用程序,该应用程序需要在运行时绘制很多多边形和折线。

I have searched the google and stackoverflow found that Dispatcher.BeginInovoke() can't satisfy my needs. 我已经搜索过Google,并且stackoverflow发现Dispatcher.BeginInovoke()无法满足我的需求。 Because I must create the DependencyObject s such as Polygon and Polyline in my non-UI thread. 因为我必须在非UI线程中创建DependencyObject例如PolygonPolyline Can you help me? 你能帮助我吗?

Thanks in advance. 提前致谢。

if you create ui element in your non-ui thread . 如果您在非ui线程中创建ui元素。

you must use dispather to make your ui thread execute ui action or else it will throw exception. 您必须使用dispather来使您的ui线程执行ui操作,否则它将引发异常。

for example : 例如 :

            ThreadHelper.RunInNewThread(() =>
            {

                Dispatcher.BeginInvoke(() => 

                         //something you want ui thread do
                    );

            }, 10);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM