问题描述
我使用以下命令显示打开文件"对话框:
I use the following to display an Open File dialog:
OpenFileDialog fdlg = new OpenFileDialog();
fdlg.FileName = Properties.Settings.Default.Last_competition_file;
fdlg.Filter = "FS database files (*.fsdb)|*.fsdb|All files (*.*)|*.*";
fdlg.FilterIndex = 0;
if (fdlg.ShowDialog(this) == DialogResult.Cancel) return false;
((Properties.Settings.Default.Last_competition_file包含到最后一个文件的完整路径)
(Properties.Settings.Default.Last_competition_file contains the whole path to the last file)
问题::对于文件名"c:\ data \ nationals_2014.fsdb",文件名"字段仅显示"ionals_2014.fsdb".
Problem: For a file name "c:\data\nationals_2014.fsdb", the File name field only shows "ionals_2014.fsdb".
当单击文件名"字段并将光标向左移动时,其余文件名&路径重新出现.但我正在寻找一种使整个文件名从一开始就可见的方法.
When clicking into the File name field, and moving the cursor to the left, the remainder of the file name & path re-appears. But I'm looking for a way to make the whole file name visible from the beginning.
请注意,这不是长度问题.我还尝试过通过OpenFileDialog.InitialDirectory分别设置路径和文件名,但是即使那样,也仅显示(现在短得多)文件名的尾部.
Note that this is not a length issue. I also tried setting path and file name separately (through OpenFileDialog.InitialDirectory), but even then only the tail end of the (now much shorter) file name was displayed.
有什么想法如何使打开文件"对话框从一开始就显示完整的预填充文件名?
Any ideas how to get the Open File dialog to show the full pre-populated file name from the beginning?
推荐答案
注意:这是 Kludge ,不是真正的答案.
Caveat: This is a Kludge, not a real answer.
OpenFileDialog fdlg = new OpenFileDialog();
fdlg.FileName = Properties.Settings.Default.Last_competition_file;
fdlg.Filter = "FS database files (*.fsdb)|*.fsdb|All files (*.*)|*.*";
fdlg.FilterIndex = 0;
fdlg.ShowHelp = true;
fdlg.HelpRequest += new System.EventHandler(HelpRequested); ;
if (fdlg.ShowDialog(this) == DialogResult.Cancel) return false;
private void HelpRequested(object sender, EventArgs e)
{
MessageBox.Show(".. is no Help", "There..");
}
对话框的样式恢复为较早的版本.
The style of the Dialog reverts to an older incarnation.
耸耸肩.一些解决方法使我对许多事情感到疑惑.
Shrug. Some workarounds make me wonder about many things..
这篇关于OpenFileDialog切断预先填充的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!