System.Windows.Forms.SaveFileDialog问题
最近遇到一BT要求。要求保存文件窗体中的combobox那个部分可以点后察看当前路径,但是不可以更改。就是不可以选择其他的文件夹。保存的文件路径必须是当前系统指定的。就是说 那些什么新建立文件夹啦,移动到桌面的那些快捷方式全部变成不可用。就给你留个文件名称让你手动输入。大家有办法没〉?????
谢谢

解决方案 »

  1.   

    当他选者后先判断FilePath 如果不是指定的就继续弹出SaveDialog
      

  2.   

    自己做一个Form来模拟咯, 然后把结果赋给saveFileDialog.FileName
      

  3.   

    是啊。我也是楼上的想法。可是那个combobox在.net03中是现成的控件吗〉?还有下面的文件列表,怎么个写法比较好。
      

  4.   

    参考下这个
    http://www.codeproject.com/info/search.asp然后自己写个CustomSaveFileDialog吧
      

  5.   

    只能自己做. COMBOX? 还是什么?
      

  6.   

    迷糊,大早上来把我地帖子整上去。首要的问题是自己做的话。那个类似于combobox的控件怎么能搞得像一点
      

  7.   

    LeoMaya(我是L.W, 这是我的故事)
    =====================================
    老大你给我个search页面作什么啊。那上面的我找了。没感觉有比较合适的
      

  8.   

    关注一下,4年前就快2星了,可是后来不搞.net了,现在回来接点分,争取再升一星!
      

  9.   

    自己重新做一个Form
    涉及的问题会比较多
    个人觉得改变外观相对来讲容易一些
    首先得借助Spy++查看消息
    然后在对话框初始化的时候调用SendMessage等API
    改变其外观
      

  10.   

    那你把事情弄简单点, 随便弄个ComboBox, 然后...
            string filePath = string.Empty;
            string fileName = string.Empty;
            string fileDir = string.Empty;
            private void comboBox1_KeyPress(object sender, KeyPressEventArgs e)
            {
                if (e.KeyChar == (Char)Keys.Back)
                {
                    if (comboBox1.Text == fileDir) e.Handled = true;
                }
                if (comboBox1.SelectionStart <= fileDir.Length)
                {
                    if (e.KeyChar != (Char)Keys.RWin) e.Handled = true;
                }
            }        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                filePath = comboBox1.SelectedItem.ToString();
                fileDir = Path.GetDirectoryName(filePath);
                fileName = Path.GetFileName(filePath);
            }目前来说, 还没怎么仔细test上面的code, 大致方向如此, 应该符合你的要求的
      

  11.   

    lovefootball(蟑螂)兄弟的思路我也是这么想的,可惜我实力不济阿。那么多涉及api的东西研究了好长时间也没真出点头绪。能深入指点下吗。赫赫。。
      

  12.   

    作下修改        string filePath = string.Empty;
            string fileName = string.Empty;
            string fileDir = string.Empty;
            private void comboBox1_KeyPress(object sender, KeyPressEventArgs e)
            {
                if (e.KeyChar == (Char)Keys.Back)
                {
                    if (comboBox1.Text == fileDir) e.Handled = true;
                }
                if (comboBox1.SelectionStart <= fileDir.Length)
                {
                    comboBox1.SelectionStart = fileDir.Length;
                    if (e.KeyChar != (Char)Keys.RWin) e.Handled = true;
                }
            }        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
            {
                filePath = comboBox1.SelectedItem.ToString();
                fileDir = Path.GetDirectoryName(filePath);
                fileName = Path.GetFileName(filePath);
            }
      

  13.   

    你可以先看看扩充Dialog的例子,比如加个文本保存的编码
    请参考
    http://www.codeproject.com/csharp/GetSaveFileName.asp然后按照这个大体思路去做
      

  14.   

    或者是这个
    这是两种不同的方法
    http://www.codeproject.com/cs/miscctrl/CustomizeFileDialog.asp
      

  15.   

    自己重新写一个类似SaveFileDialog窗体的窗体就行了