码迷,mamicode.com
首页 > 编程语言 > 详细

wpf 线程与界面线程

时间:2016-08-30 10:42:12      阅读:250      评论:0      收藏:0      [点我收藏+]

标签:

Thread thread = new Thread(new ThreadStart(() =>
        {
            VisualTarget visualTarget = new VisualTarget(hostVisual);
            var control = new UserControl1();
            control.Arrange(new Rect(new Point(), content.RenderSize));
            visualTarget.RootVisual = control;

            System.Windows.Threading.Dispatcher.Run();

        }));

        thread.SetApartmentState(ApartmentState.STA);
        thread.IsBackground = true;
        thread.Start();

 

 

 System.Windows.Application.Current.Dispatcher.Invoke(() =>
{

//界面线程不要执行大量操作 否则还是卡顿
});

wpf 线程与界面线程

标签:

原文地址:http://www.cnblogs.com/pengde/p/5820860.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!