我关注了this article这解释了如何使用 .NET 扩展 Windows 的内置文件打开/保存对话框。经过一些小改动后,一切正常,但对话框的外观与其他对话框略有不同。这并不重要,但我很好奇背后的原因是什么。
我的对话框(平面按钮):
其他对话框(3D 按钮):
最佳答案
来自那篇文章的评论:
The SaveFileDialogWithEncoding example is great. However, the look and feel are "old style" -- in other words, the buttons and controls don't have the new "XP look" (i.e. rounded buttons, etc.). It's probably a flag setting in one of the fields in the OPENFILENAME structure and I'm looking into that. I was just wondering if you (or anyone else) had any insight to solving that problem.
然后是 self 回答:
Never mind -- figured it out. Before you instantiate the form object you need to call Application.EnableVisualStyles() like so:
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new Form1());
}
关于.net - 扩展的打开/保存文件对话框中的视觉样式异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11307258/