ShowPreview()上的背景工作者 [英] Background Worker on ShowPreview()

查看:149
本文介绍了ShowPreview()上的背景工作者的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个与backgroundWorker一起使用所需的按钮.
此按钮打开一个打印预览窗口.

Hi,

I have a button that is required to work with backgroundWorker.
This button opens a printpreview window.

if (Mode == 2)
                {
                    TellerPrintForm rptTransactionData = new TellerPrintForm(TrxMaster.IdTransactionMaster);
                    rptTransactionData.ShowPreview();
                    Application.DoEvents();
                }



问题是,我无法将此代码放入doWork()中.它不会引发任何异常,它只是打开没有内部内容的窗口.

如果将它们全部放入RunCompleted()事件,则与我未使用任何backgroundWorker相同. :)

我也不能分开.

使后台工作者执行此工作的最佳方法是什么?

谢谢



The problem is, I can''t put this code into doWork(). It doesn''t throw any exception it''s just opens the window without the content inside.

If I put it all in the RunCompleted() event, then it''s same as I didn''t used any backgroundWorker. :)

Also I can''t separate it.

What is the best approach to make this work with background worker?

Thanks

推荐答案

您刚刚问了这个问题!!

对于所有线程到UI线程的调用,该调用都是必需的.您其他问题的答案也适用于这里:

backgroundWorker1_ProgressChanged问题 [
You just asked this!!!!

The invoke is necessary for all thread to UI thread calls. The answer in your other question also applies here:

backgroundWorker1_ProgressChanged Problem[^]

Good luck!


这篇关于ShowPreview()上的背景工作者的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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