开发者

.net OpenFileDialog changing the CurrentDirectory

I am using OpenFileDialog. But using it changes the Environment.CurrentDirectory. Using the RestoreDirectory property solves this issue, but I'm using external dlls that I can't control that don't use RestoreDirectory.

Is there a way t开发者_如何学Co make it true as default? Or is there any other solution to this annoying problem?

Thanks.


Saving the current path and restoring it after the dialog has been shown would do the trick imo:

var currentDir = Environment.CurrentDirectory;

// Show File open dialog etc ...

Environment.CurrentDirectory = currentDir;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜