您是第欢迎光临我的主页位访客
浩凡儿
天行健,君子以自强不息;地势坤,君子以厚德载物!

如果 在Win7下要通过某个 线程 来调用SavaDialog文件选择框的代码  选择窗口 有时会出不来 需要设置如下:
    ThreadthreadOfRec = new Thread(ReciveMsg);
                threadOfRec.SetApartmentState(ApartmentState.STA);
                threadOfRec.IsBackground = true;
                threadOfRec.Start();


  SaveFileDialog sfd = new SaveFileDialog();
                        if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            using (FileStream fs = new FileStream(sfd.FileName, FileMode.OpenOrCreate))
                            {
                                fs.Write(msgRecived, 1, length - 1);
                                MessageBox.Show("文件写入成功!!!");
                            }
                        }

posted on 2014-10-03 20:53  浩凡儿  阅读(375)  评论(0编辑  收藏  举报