为什么Winform中新开 Thread 调用 OpenFileDialog 时要设置 STA 模式
引子,一位同学在使用线程时,业务需要调用打开文件窗口,遇到的有意思的问题!
先看正确案例代码
Thread myThead = new Thread(() => {
OpenFileDialog myOpenFileDialog = new OpenFileDialog();
if (myOpenFileDialog.ShowDialog() == DialogResult.OK)
// TODO ...