Reputation: 83
I wonder how to display old style Open/Save file dialog in WinForms
this image is from VCE simulator , you can see there's no help button under Cancel button
I use this code to display the old style
var sfd = new SaveFileDialog();
sfd.Filter = "VSE Exam Files (*.vce)|*.vce";
sfd.ShowHelp = true;
if ( sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK )
{
// Save document
}
but I don't want to display help button as it will not help you any way
I tried to switch my target .NET to 3.5, but still displays the new style
please help, am I missing some thing or what?
Upvotes: 1
Views: 1889
Reputation: 1631
Try setting AutoUpgradeEnabled
to false instead of ShowHelp
var sfd = new SaveFileDialog();
sfd.Filter = "VSE Exam Files (*.vce)|*.vce";
sfd.AutoUpgradeEnabled = false;
if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
// Save document
}
MSDN says:
If this property is false, the FileDialog class will have a Windows XP-style appearance and behavior on Windows Vista.
But on my system it works for Windows 7 as well.
Upvotes: 1
Reputation: 1326
var sfd = new SaveFileDialog();
sfd.Filter = "VSE Exam Files (*.vce)|*.vce";
// sfd.ShowHelp = true; no need this.
if ( sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK )
{
// Save document
}
Upvotes: 0
Reputation: 196
You just need to assign false to ShowHelp property :
var sfd = new SaveFileDialog();
sfd.Filter = "VSE Exam Files (*.vce)|*.vce";
sfd.ShowHelp = false;
if ( sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK )
{
// Save document
}
Upvotes: 0
Reputation: 5835
You can look in here:
http://www.codeproject.com/Articles/19566/Extend-OpenFileDialog-and-SaveFileDialog-the-easy
Just remove the parts you don't need.
Upvotes: 0