zoukankan      html  css  js  c++  java
  • WPF打开或新建对话框

    调出windows对话框新建文件

    使用System.Windows.Forms.SaveFileDialog或者Microsoft.Win32.SaveFileDialog

    System.Windows.Forms.SaveFileDialog saveFile = new System.Windows.Forms.SaveFileDialog();
                saveFile.Title = "新建文件";
                saveFile.FileName = "";
                saveFile.Filter = "*.txt";        //新建文件类型为txt
                
                string filename = string.Empty;
                if (saveFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    // Save document
                    System.IO.FileStream fs = (System.IO.FileStream)saveFile.OpenFile();//输出文件
                   
                }
                else
                {
                    return;
                }

    打开文件

    使用System.Windows.Forms.OpenFileDialog 或者Microsoft.Win32.OpenFileDialog

    System.Windows.Forms.OpenFileDialog openFile = new System.Windows.Forms.OpenFileDialog();
                openFile.Title = "打开文件";
                openFile.Filter = _filePathParameter.fileFilter();
                if (openFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    TextValue = openFile.FileName;         //获取文件位置+文件名
                }
  • 相关阅读:
    19.将写好的输出到本地 文件格式:Step
    18.对Topo进行打孔
    17.球体
    16.圆柱
    15.绘制圆锥
    14.Chamfer把正方体所有的边倒角
    13.绘制一个方体
    ①②坐标点
    esp8266接线
    IP解析
  • 原文地址:https://www.cnblogs.com/ZM191018/p/12401889.html
Copyright © 2011-2022 走看看