本文介绍了OpenFileDialog.AutoUpgradeEnabled在Vista或7下不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我指定OpenFileDialog.AutoUpgradeEnabled = true,则程序仍显示旧的XP样式对话框.知道为什么会这样吗?这是在Main()中启用主题设置之后
If I specify OpenFileDialog.AutoUpgradeEnabled = true, my program still shows the old XP-style dialog. Any idea why this would happen? This is after I enable theming in Main()
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.Run(new Primary());
}
这是我的对话代码:
private void OpenProgramFile()
{
OpenFileDialog programFileDialog = new OpenFileDialog();
programFileDialog.Filter = "Program files (*.exe;*.lnk)|*.exe|All files (*.*)|*.*";
programFileDialog.FilterIndex = 0;
programFileDialog.Title = "Select program file";
programFileDialog.AutoUpgradeEnabled = true;
programFileDialog.ShowHelp = true;
DialogResult fileResult = programFileDialog.ShowDialog();
if (fileResult != DialogResult.OK)
return false;
programFileDialog.Dispose();
}
那为什么AutoUpgradeEnabled不起作用?
So why would AutoUpgradeEnabled not work?
推荐答案
避免设置programFileDialog.ShowHelp=true
. ShowHelp
属性与Vista/7文件对话框UI不兼容.打开的文件对话框仍将显示一个问号帮助图标.
Avoid setting programFileDialog.ShowHelp=true
. The ShowHelp
property is not compatible with the Vista/7 file dialog UI. The open file dialog will still show a question-mark help icon.
这篇关于OpenFileDialog.AutoUpgradeEnabled在Vista或7下不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!