本文整理汇总了C#中OpenFileDialog.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# OpenFileDialog.Dispose方法的具体用法?C# OpenFileDialog.Dispose怎么用?C# OpenFileDialog.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenFileDialog
的用法示例。
在下文中一共展示了OpenFileDialog.Dispose方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FileManager
public FileManager()
{
this.m_BasePath = Application.StartupPath;
this.m_FilePath = Engine.m_OverrideDataPath;
if (this.m_FilePath == null)
{
this.m_FilePath = this.GetExePath("Ultima Online");
if (this.m_FilePath == null)
{
this.m_FilePath = this.GetExePath("Ultima Online Third Dawn");
if (this.m_FilePath == null)
{
OpenFileDialog dialog = new OpenFileDialog {
CheckPathExists = true,
CheckFileExists = false,
FileName = "Client.exe",
Filter = "Client.exe|Client.exe",
Title = "Find your UO directory",
InitialDirectory = Path.GetPathRoot(this.m_BasePath)
};
if (dialog.ShowDialog() == DialogResult.OK)
{
this.m_FilePath = Path.GetDirectoryName(dialog.FileName);
}
else
{
MessageBox.Show("Couldn't find UO directory.", "Client");
}
dialog.Dispose();
}
}
this.m_Error = this.m_FilePath == null;
}
}
示例2: SelectPicture_Click
private void SelectPicture_Click(object sender, EventArgs e)
{
OpenFileDialog openfile = new OpenFileDialog();
if(openfile.ShowDialog()==DialogResult.OK&&(openFileDialog1.FileName!=""))
{
pictureBox.ImageLocation = openfile.FileName;
textPath.Text = openfile.FileName;
}
openfile.Dispose();
}
示例3: OpenFileButton_Click
void OpenFileButton_Click (object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog ();
ofd.Filter = "Text files (*.txt)|*.txt|Source files (*.cs)|*.cs|Application files (*.exe)|*.exe|All files (*.*)|*.*";
ofd.FilterIndex = 2;
ofd.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
ofd.ShowDialog ();
MessageBox.Show (string.Format (CultureInfo.InvariantCulture,
"FilterIndex: {0}", ofd.FilterIndex));
ofd.Dispose ();
}
示例4: clickOpen
protected void clickOpen(object sender, EventArgs e)
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "ficheros de texto |*.txt|Todos los ficheros|*.*";
if(ofd.ShowDialog() == DialogResult.OK)
{
String filename = ofd.FileName;
String texto = File.ReadAllText(filename);
this._txtTexto.Buffer.Text = texto;
}
ofd.Dispose();
}
示例5: uploadImageL10PerUploadToolStripMenuItem_Click
private void uploadImageL10PerUploadToolStripMenuItem_Click(object sender, EventArgs e)
{
try
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image Files(*.jpg; *.jpeg; *.tga; *.bmp; *.png)|*.jpg; *.jpeg; *.tga; *.bmp; *.png";
string ext = string.Empty;
if (open.ShowDialog() == DialogResult.OK)
{
Bitmap bitmap = new Bitmap(open.FileName);
ext = Path.GetExtension(open.FileName).ToLower(CultureInfo.CurrentCulture);
(new UploadImage(instance, bitmap, open.FileName, ext)).Show(this);
}
open.Dispose();
}
catch (Exception)
{
throw new ApplicationException("Failed loading image");
}
}
示例6: mInsertOnClick
private void mInsertOnClick(object sender, EventArgs ea)
{
//insert file
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "Select file";
ofd.Filter = "All Files (*.*)|*.*|Dll Files (*.dll)|*.dll";
if (ofd.ShowDialog() == DialogResult.OK)
{
Cursor.Current = Cursors.WaitCursor;
FileInfo fi = new FileInfo(ofd.FileName);
ListViewFileItem lvi = new ListViewFileItem();
lvi.Text = Path.GetFileName(ofd.FileName);
lvi.SubItems.Add("Yes");
lvi.SubItems.Add("No");
lvi.SubItems.Add("No");
lvi.SubItems.Add(fi.Length.ToString("n0"));
lvi.Offset = 0;
lvi.Size = (int)fi.Length;
lvi.SubItems.Add(Path.GetFullPath(ofd.FileName));
if (contents.SelectedItems.Count == 0)
{
//no items selected so add at bottom
contents.Items.Add(lvi);
}
else
{
//insert before first selected item
contents.Items.Insert(contents.SelectedItems[0].Index, lvi);
}
//check for _virtual.dat
if (lvi.Text == "_virtual.dat")
{
//get display settings from _virtual.dat
FileStream fsIn = null;
BinaryReader brIn = null;
try
{
fsIn = new FileStream(ofd.FileName, FileMode.Open);
brIn = new BinaryReader(fsIn);
displayMode = brIn.ReadInt32();
displayWidth = brIn.ReadInt32();
displayHeight = brIn.ReadInt32();
displayDepth = brIn.ReadInt32();
contents.ContextMenu.MenuItems[0].Text = proExe.getDisplayString(displayWidth, displayHeight, displayDepth, displayMode);
contents.ContextMenu.MenuItems[0].Enabled = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
brIn.Close();
fsIn.Close();
}
}
Cursor.Current = Cursors.Default;
}
ofd.Dispose();
//enable menu items
if (contents.Items.Count > 0)
{
contents.ContextMenu.MenuItems[2].Enabled = true; //save
contents.ContextMenu.MenuItems[11].MenuItems[0].Enabled = true; //decompress
}
}
示例7: mLoadOnClick
private void mLoadOnClick(object sender, EventArgs e)
{
//load exe
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "Select exe";
ofd.Filter = "Exe or Pck files (*.exe, *.pck)|*.exe;*.pck|All Files (*.*)|*.*";
if (ofd.ShowDialog() == DialogResult.OK)
{
LoadExe(ofd.FileName);
}
ofd.Dispose();
}
示例8: browse_Click
private void browse_Click(object sender, System.EventArgs e)
{
//browse for file
OpenFileDialog dlg = new OpenFileDialog();
dlg.Title = "Select file";
dlg.Filter = "All files (*.*)|*.*";
if (dlg.ShowDialog() == DialogResult.OK)
{
pathname.Text = dlg.FileName;
}
dlg.Dispose();
}
示例9: RestoreData
/// <summary>
/// Restore current user's settings and problem description from a .uapak file.
/// Depends on external program "unzip\zipit.exe"
/// </summary>
public static void RestoreData()
{
string path = LocalDirectory.DefaultPath;
if (!System.IO.Directory.Exists(path)) return;
string file = @"unzip\zipit.exe";
file = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), file);
if (!System.IO.File.Exists(file)) return;
OpenFileDialog ofd = new OpenFileDialog();
ofd.FileName = "Problems.uapak";
ofd.Filter = "UVA Arena Package | *.uapak";
if (ofd.ShowDialog() == DialogResult.OK)
{
System.Threading.ThreadPool.QueueUserWorkItem(Restore, ofd.FileName);
}
ofd.Dispose();
}
示例10: MenuItem21Click
private void MenuItem21Click(object sender, EventArgs e)
{
var ofd = new OpenFileDialog
{
InitialDirectory = Program.AppPath,
Filter = "iSpy Files (*.ispy)|*.ispy|XML Files (*.xml)|*.xml"
};
if (ofd.ShowDialog(this) == DialogResult.OK)
{
string fileName = ofd.FileName;
if (fileName.Trim() != "")
{
LoadObjectList(fileName.Trim());
}
}
ofd.Dispose();
}
示例11: load_Click
private void load_Click(object sender, EventArgs e)
{
//load
OpenFileDialog dlg = new OpenFileDialog();
dlg.Title = "Selet Dbpro exe";
dlg.Filter = "Exe files (*.exe)|*.exe|All Files(*.*)|*.*";
if (dlg.ShowDialog() == DialogResult.OK)
{
Intern.Enabled = true;
Intern.Items.Clear();
Extern.Enabled = true;
Extern.Items.Clear();
if (exeType.SelectedIndex == 0)
{
//new type
Targetexe.Enabled = false;
}
else
{
//old type
Targetexe.Enabled = true;
}
//load exe
proExe.LoadExe(Extern, dlg.FileName);
//move required items into Intern
foreach (ListViewFileItem lvi in Extern.Items)
{
if (lvi.Text.StartsWith("<") || lvi.Text == "_virtual.dat")
{
lvi.Remove();
Intern.Items.Add(lvi);
}
}
Loaded_ExeName = dlg.FileName;
if (Targetexe.Text == "")
Targetexe.Text = "mini_"+Path.GetFileName(dlg.FileName);
Intern.EndUpdate();
Extern.EndUpdate();
}
dlg.Dispose();
}
示例12: btnDbpro_Click
private void btnDbpro_Click(object sender, EventArgs e)
{
//dbpro.exe location
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "Locate DbPro exe";
ofd.Filter = "Dbpro exe (*.exe)|*.exe|All Files (*.*)|*.*";
if (ofd.ShowDialog() == DialogResult.OK)
{
dbpExe = ofd.FileName;
}
ofd.Dispose();
}
示例13: btnDll_Click
private void btnDll_Click(object sender, EventArgs e)
{
//set dll_tool.exe location
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "Locate dll_tool.exe";
ofd.Filter = "dll_tool.exe|dll_tool.exe|All Files (*.*)|*.*";
if (ofd.ShowDialog() == DialogResult.OK)
{
dllTool = ofd.FileName;
}
ofd.Dispose();
}
示例14: btnEditGame_Click
private void btnEditGame_Click(object sender, System.EventArgs e)
{
RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Imagine Interactive\Gameserver Panel\Games");
String[] gameList = key.GetSubKeyNames();
String gameName = gameList[this.games.SelectedIndex];
OpenFileDialog openFile = new OpenFileDialog();
openFile.Filter = "Ausführbare Dateien|*.exe";
openFile.Title = gameName;
if (openFile.ShowDialog() == DialogResult.OK)
{
FileInfo fi = new FileInfo(openFile.FileName);
RegistryKey game = key.OpenSubKey(gameName, true);
game.SetValue("isInstalled", 1);
if (game.GetValue("needpath").ToString() == "1") {
game.SetValue("command", fi.Name);
}
game.SetValue("installPath", fi.FullName);
game.Close();
}
openFile.Dispose();
key.Close();
this.loadGames();
}
示例15: selectOldExe_Click
private void selectOldExe_Click(object sender, EventArgs e)
{
//select old exe
OpenFileDialog ofd = new OpenFileDialog();
ofd.Title = "Select old exe";
ofd.Filter = "Dbpro exe (*.exe)|*.exe|All Files (*.*)|*.*";
if (ofd.ShowDialog() == DialogResult.OK)
{
Cursor.Current = Cursors.WaitCursor;
oldExeName = ofd.FileName;
gbOld.Text = "Old exe (" + Path.GetFileName(ofd.FileName) + ")";
oldExe.BeginUpdate();
oldExe.Items.Clear();
proExe.LoadExe(oldExe, false, ofd.FileName);
oldExe.EndUpdate();
//analyse if required
if (newExeName != null)
analyse();
Cursor.Current = Cursors.Default;
}
ofd.Dispose();
}