zoukankan      html  css  js  c++  java
  • 在WPF中调用打开文件对话框

     1             // Create OpenFileDialog
     2             Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
     3 
     4             // Set filter for file extension and default file extension
     5             dlg.DefaultExt = ".txt";
     6             dlg.Filter = "JPEG Files (*.jpeg)|*.jpeg|PNG Files (*.png)|*.png|JPG Files (*.jpg)|*.jpg|GIF Files (*.gif)|*.gif";
     7 
     8             // Display OpenFileDialog by calling ShowDialog method
     9             Nullable<bool> result = dlg.ShowDialog();
    10 
    11             // Get the selected file name and display in a TextBox
    12             if (result == true)
    13             {
    14                 // Open document
    15                 string filename = dlg.FileName;
    16                 this.txtPlace.Text = filename;
    17             }

     Using Open File Dialog in WPF

  • 相关阅读:
    毕设进度28
    任务27
    任务26
    任务25
    任务24
    第二次冲刺
    课堂作业-搜狗输入法
    课堂作业-寻找水王
    博客花园典型用户和场景
    第十天
  • 原文地址:https://www.cnblogs.com/cicaday/p/4008235.html
Copyright © 2011-2022 走看看